https to http 301 redirect via htaccess

柔情痞子 提交于 2020-02-29 04:35:10

问题


I'm trying to redirect all the https url to http. As my new server doesn't have ssl enabled.

So Far I tried following but none of them worked.'

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301] 

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

RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

回答1:


Try :

RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]   


来源:https://stackoverflow.com/questions/12226795/https-to-http-301-redirect-via-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!