Apache 将除两个页面外的所有HTTPS重定向到HTTP
我在这个网站上尝试了其他主题的帮助,但是我遇到了重定向循环错误 我当前的访问代码:-Apache 将除两个页面外的所有HTTPS重定向到HTTP,apache,.htaccess,Apache,.htaccess,我在这个网站上尝试了其他主题的帮助,但是我遇到了重定向循环错误 我当前的访问代码:- RewriteEngine on RewriteCond %{SERVER_PORT} ^80$ RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteRule ^([^.]+)/?$ index.php?v=$1 [QSA,L] RewriteEngine on
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^([^.]+)/?$ index.php?v=$1 [QSA,L]
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^([^.]+)/?$ index.php\?v=$1 [QSA,L]
以上内容与此问题无关,但为了得到您的适当帮助,我已将其包括在内
现在我想将所有https URL重定向到http,除了两个/login/和/register/
如何确保使用最低条件。除非您坚持使用.htaccess,否则您可以在要转到http的页面顶部使用PHP检查并使用标题位置将其发送到http
if($_SERVER['SERVER_PORT'] == 443)
header('Location: http://'.$_SERVER['HTTP_HOST'].'/'.$rest_of_path);
这里有一些关于如何构建整个url的好信息,以便它们进入同一页面。