通过htaccess将https重定向到http 301 [英] https to http 301 redirect via htaccess

查看:98
本文介绍了通过htaccess将https重定向到http 301的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将所有https网址重定向到http。由于我的新服务器未启用ssl。

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]


推荐答案

尝试:

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

这篇关于通过htaccess将https重定向到http 301的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆