我有这个.htaccess
文件:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
我是否可以强制所有HTTP访问尝试在正常处理HTTPS访问时为特定页面(例如/https-required.html
)提供服务?
以下是我期望的行为示例,其中允许一些变体(例如,如果/https-required.html
只能 通过HTTP提供,则可以接受):< / p>
http://www.ex.com/ => http://www.ex.com/https-required.html
http://www.ex.com/valid-page.html => http://www.ex.com/https-required.html
http://www.ex.com/invalid-page.html => http://www.ex.com/https-required.html
http://www.ex.com/https-required.html => http://www.ex.com/https-required.html
https://www.ex.com/ => https://www.ex.com/
https://www.ex.com/valid-page.html => https://www.ex.com/valid-page.html
https://www.ex.com/invalid-page.html => https://www.ex.com/404.html
https://www.ex.com/https-required.html => https://www.ex.com/https-required.html
我希望将整个网站限制为HTTPS,但为此我必须考虑HTTP访问尝试。我想我可以完全禁用HTTP,比如
SSLRequireSSL
但这会导致意外HTTP访问的悲惨经历。解决此问题的更常见方法是简单地将http://
重定向到https://
,例如
Redirect permanent / https://www.example.com
或
RewriteCondition %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
但我特意希望避免这种重定向。
答案 0 :(得分:1)
你可以像这样使用它:
autoresizingMask