HTTPS重定向到http在.htacces有一些例外 [英] Redirecting https to http in .htacces with some exceptions

查看:456
本文介绍了HTTPS重定向到http在.htacces有一些例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Magento的网站,网站上的所有页面都通过HTTP和HTTPS访问,这可能会导致与谷歌的重复内容的问题。我需要适当的编码重定向在htacces所有https网页访问http除了这些页面的:

I'm using a magento website and all pages on the site are accessible through http and https and that might be causing duplicate content issues with google. I need the proper coding for redirecting in htacces all the https pages to http with the exception of these pages:

  • https://www.example.com/checkout/onepage/
  • /customer/account/
  • /checkout/multishipping/login/
  • /wishlist/
  • /index.php/admin/dashboard/index/key/

(不知道你是否需要这些一个单独的例外规则,或者它包含在previous的)

(Not sure if you need a seperate exception rule for these or it's included in the previous ones)

  • /结账/ multishipping /地址/
  • /心愿/指数/指数/
  • /客户/帐号/登录/
  • /结账/ onepage /成功

将不胜AP preciate如果任何人都可以提供帮助。谢谢你。

Would greatly appreciate if anyone can help. Thanks.

推荐答案

尝试:

RewriteEngine On

# From https to http
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/checkout/onepage/
RewriteCond %{REQUEST_URI} !^/customer/account/
RewriteCond %{REQUEST_URI} !^/checkout/multishipping/login/
RewriteCond %{REQUEST_URI} !^/wishlist/
RewriteCond %{REQUEST_URI} !^/index.php/admin/dashboard/index/key/
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

# From http to https
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/checkout/onepage/ [OR]
RewriteCond %{REQUEST_URI} ^/customer/account/ [OR]
RewriteCond %{REQUEST_URI} ^/checkout/multishipping/login/ [OR]
RewriteCond %{REQUEST_URI} ^/wishlist/ [OR]
RewriteCond %{REQUEST_URI} ^/index.php/admin/dashboard/index/key/
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

这篇关于HTTPS重定向到http在.htacces有一些例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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