我有一个这样的服务器上的redirect设置:
<IfModule mod_rewrite.c> RewriteEngine On #redirect all port 80 traffic to 443 RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L] </IfModule>
现在我想排除一个域名,我似乎无法解决…
这是我试过的:
<IfModule mod_rewrite.c> RewriteEngine On #redirect all port 80 traffic to 443 RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST) !example.com RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L] </IfModule>
不过,它仍然会将http://example.comredirect到https://example.com 。 我究竟做错了什么?
PS。 我在其他浏览器尝试,所以浏览器caching不应该是一个问题。
好像你在这里拼错了configuration(注意大括号)
更换
RewriteCond %{HTTP_HOST) !example.com
有了这个
RewriteCond %{HTTP_HOST} !example\.com