【发布时间】:2014-09-06 02:26:05
【问题描述】:
我知道这个问题被问了很多,但我尝试了很多答案并没有成功。 我尝试这些答案: .htaccess ssl & non-ssl redirects
Remove SSL integration from a specific folder using htaccess
还有一些我在谷歌上找到的。 我在网站的 3 个页面上只有 ssl,我想制定一个一般规则,即其他页面在 https 上时应重定向到 http。我喜欢 Jon Snow 我对 apache 和 htaccess 一无所知。
这就是我目前所尝试的:
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^\/(page1|page2|page3)+ [NC]
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L]
还有这个:
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/page1/$
RewriteCond %{REQUEST_URI} !^/page2/$
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L]
发送到 http 的部分有效,但异常不发送或全部发送到 http 或重定向到索引。
澄清我没有同时输入两个代码。
其他规则:
RewriteCond %{HTTP_HOST} !^www\.example\.com\$
RewriteRule (.*) http://www.example.com.br/$1 [R=301,L]
RewriteRule !\.(js|txt|ico|gif|GIF|jpg|JPG|png|PNG|css|swf|pdf|xml|XML|eot|EOT|ttf|TTF|woff|WOFF)$ index.php
请求的完整网址: https://www.example.com.br/area-restrita/ 在“area-restrita”部分之后可以有更多信息
【问题讨论】:
-
提供一个您想要排除但不适合您的完整 URL 示例?你在这个.htaccess中还有其他规则吗?
-
我编辑问题以放置其他规则
-
但是您没有提供要排除的完整 URL 示例,并且不适合您
-
再次编辑,使用完整的网址
标签: apache .htaccess mod-rewrite ssl