从HTTPS重定向中排除一个URL

时间:2017-01-11 15:52:15

标签: .htaccess

我想排除:
http://domain.com/index.php?route=payment/redsys/callback
这就是我在.htacess中所拥有的

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

将所有网址转换为https,如何排除要转换为https的网址? 感谢

1 个答案:

答案 0 :(得分:1)

尝试使用此功能,只需将directory替换为您要停止编组HTTP的文件夹目录。

RewriteEngine On

#Turns HTTPs on for everything, excluding directory
RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} !^\/directory\/
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]    

#Turns HTTP on for directory
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} \/directory\/
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L,R=301]