谷歌已经用https索引了我网站的主页。但我只需要将 https 重定向到 http 这个页面。我正在使用 Magento,今天我有一条规则可以删除我域的 htaccess www。我创建的将 https 的主页重定向到 http 的每个规则都不起作用。
有人有解决方案吗?
谢谢你
4 回答
尝试
#Redirect your Homepage from HTTPS to HTTP
RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HTTP_HOST} [L,R]
请参阅http://www.activo.com/redirect-https-to-http-for-any-homepage/
首先在 Magento 中进行设置:
打开管理面板并访问System -> Configration -> Web panel
并设置:
基本 URL(不安全)为
http://www.domain.com/magento/
.基本 URL(安全)为
https://www.domain.com/magento/
.
然后设置:
在前端使用安全 URL = 是
保存您的设置,清除您的 Magento 缓存
最后在 Magento 的 .htaccess 中在 RewriteBase 行下面添加这些行:
RewriteCond %{HTTPS} off
RewriteRule (?!^(index\.php/?|.*\.css|.*\.js|.*\.gif|.*\.jpe?g|.*\.png|.*\.txt|.*\.ico|)$)^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
RewriteCond %{HTTPS} on
RewriteRule ^(index\.php/?|.*\.css|.*\.js|.*\.gif|.*\.jpe?g|.*\.png|.*\.txt|.*\.ico|)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NC]
将此与谷歌索引器的 301 http 请求一起使用。
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
如果您使用 includeflare,则此重定向不起作用
在您的 htaccess 文件及其 cloudflare 格式上尝试以下内容
Http 到 Https 重定向:
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]
见说明:
在 CloudFlare 中使用灵活 SSL 时,您的源服务器将始终接受通过 HTTP(端口 80)的请求。为了正确重定向通过 HTTPS 安全上网的用户,您应该修改重写规则以使用 CF-Visitor HTTP 标头。CF-Visitor 标头包含以下内容:
CF-Visitor: {"scheme":"http"}
或
CF 访问者:{"scheme":"https"}
要将用户从 HTTP 重定向到 HTTPS,可以使用以下命令:
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]
同样,要要求 CloudFlare 上的所有流量都通过 HTTPS,您可以使用以下命令:
RewriteCond %{HTTP:CF-Visitor} !'"scheme":"http"'
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]