仅对特定文件强制http而不是https

时间:2012-01-06 05:01:39

标签: apache .htaccess

对于特定文件,我想强制使用http而不是https

示例:

https://example.com/test.php?parameter1=value1

应该发送到

http://example.com/test.php?parameter1=value1

我怎样才能做到这一点?

2 个答案:

答案 0 :(得分:2)

你的问题不是很清楚,但试试这个.htaccess代码:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^parameter1=.*$ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^test\.php/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA,NC]

如果原始网址中存在QUERY字符串parameter1=something,则会重定向。如果要将所有/test.php URI重定向到https,请删除第一个RewriteCond行。

答案 1 :(得分:0)

类似的东西:


RewriteRule ^https://example.com(.*) http://example.com$1 [R=301,NC]

相关问题