Mod rewrite 在所有页面上强制使用https,但在查询字符串参数中具有特定值的页面除外
我已经搜索过这个网站,但我的解决方法不起作用 基本上,我需要打开所有页面的https,只有一个页面的url如下:Mod rewrite 在所有页面上强制使用https,但在查询字符串参数中具有特定值的页面除外,mod-rewrite,redirect,https,Mod Rewrite,Redirect,Https,我已经搜索过这个网站,但我的解决方法不起作用 基本上,我需要打开所有页面的https,只有一个页面的url如下: domain.com/begin/index.php?pageid=130&usertype=1&building=2 RewriteEngine On #HTTPS OFF on pageid 130 RewriteCond %{HTTPS} on RewriteCond %{QUERY_STRING} (^|&)pageid=(130)($|&
domain.com/begin/index.php?pageid=130&usertype=1&building=2
RewriteEngine On
#HTTPS OFF on pageid 130
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} (^|&)pageid=(130)($|&)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#FORCE HTTPS ON ALL PAGES except for pageid 130
RewriteCond %{HTTPS} off
RewriteCond %{QUERY_STRING} !(^|&)pageid=(130)($|&)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
如果页面具有查询字符串参数pageid=130,我不希望打开https
我的.htaccess文件如下所示:
domain.com/begin/index.php?pageid=130&usertype=1&building=2
RewriteEngine On
#HTTPS OFF on pageid 130
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} (^|&)pageid=(130)($|&)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#FORCE HTTPS ON ALL PAGES except for pageid 130
RewriteCond %{HTTPS} off
RewriteCond %{QUERY_STRING} !(^|&)pageid=(130)($|&)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
哈哈!小错误但很难发现:您仍然重定向到https;。只需删除“s” 否则可能会确定重定向并停止重写过程=最后一次=L