【发布时间】:2014-11-27 19:59:17
【问题描述】:
我想将所有 HTTPS 请求重定向到 HTTP,但包含此字符串的 url 除外: "/account/buy-premium"
这是我的 .htaccess 文件:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} ^/account/buy-premium [NC]
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/account/buy-premium [NC]
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller... Default Laravel conf
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
https://example.com/test-page 正在重定向到 http://example.com/test-page(好)
但是
https://example.com/account/buy-premium/991 正在重定向到 http://example.com/index.php(不好 - 这里不需要重定向)
我找不到任何解决方案来阻止 /buy-premium 页面的重定向
请帮忙
【问题讨论】:
标签: regex apache .htaccess mod-rewrite laravel