全局如何将所有https重定向到具有301的http,除了某些URL

时间:2016-04-13 10:04:16

标签: .htaccess

我们希望使用htaccess mod_rewrite将所有https重定向到http为301,除了包含这些子字符串的某些网址。

/checkout/, /customer/, /cart/

全球重定向有很多例子。但是如何结合规则中的一些例外来实现这一目标呢?

1 个答案:

答案 0 :(得分:1)

您可以尝试使用此文件:

RewriteEngine on
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/checkout/
RewriteCond %{REQUEST_URI} !^/customer/
RewriteCond %{REQUEST_URI} !^/cart/
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
相关问题