php - htaccess,重定向网站但出现异常

  显示原文与译文双语对照的内容

我在重定向整个网站有几个例外。 我有以下规则和条件:


Options +FollowSymlinks
RewriteEngine On
RewriteBase/

#RewriteCond %{HTTP_HOST}!^loans.myoldwebsite.com$ [NC]
#RewriteCond %{HTTP_HOST}!^client.myoldwebsite.com$ [NC]
#RewriteRule ^(.*)$ https://www.mynewwebsite.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST}!^(client|loans).myoldwebsite.com$ [NC]
RewriteRule ^(.*)$ https://www.mynewwebsite.com/$1 [L,NE,R=302]

但我也要确保 http://www.myoldwebsite.com/getLead.php 也被忽略,因此它不被重定向。

时间: 作者:

你可以拥有多个 RewriteCond:


RewriteCond %{HTTP_HOST}!^(client|loans).myoldwebsite.com$ [NC]
RewriteCond %{REQUEST_URI}!^/getLead.php$
RewriteRule ^(.*)$ https://www.mynewwebsite.com/$1 [L,NE,R=302]

作者:
...