没有特定目录的特定域的重写规则
Rewrite Rule for specific domain without specific directory
我们的服务器上有多个商店,现在正在尝试将一个商店设置为离线,但仍然允许我们的它访问后端。
RewriteCond %{HTTP_HOST} ^(www\.)olddomain\.de$ [NC]
RewriteCond %{HTTP_HOST} !^(www\.)olddomain\.de\/backend\/$ [NC]
RewriteRule .* http://www.newdomain.de [L,R=301]
但是当我们尝试访问 www.olddomain.de/backend/ 时,我们仍然会被重定向到 www.newdomain.de。
如果不为每家商店设置重写规则,我们如何建立这一点。
感谢您的帮助。
- 第 1 行始终是 www.olddomain.de,而不是 olddomain.de,有或没有 www.
- 第 2 行不是 HTTP_HOST header,它是一个 URI。
- 第 3 行未将 URL 传递到新域
尝试将其更改为
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.de$ [NC]
RewriteCond %{REQUEST_URI} !^/backend/ [NC]
RewriteRule (.*) http://www.newdomain.de/ [L,R=301]
所以现在读
If the host is either www.olddomain.de or olddomain.de, and the requested URI doesn't begin with /backend, optionally followed by further URI details, then rewrite the host from olddomain.de to www.newdomain.de and pass the requested URI to www.newdomain.de
我们的服务器上有多个商店,现在正在尝试将一个商店设置为离线,但仍然允许我们的它访问后端。
RewriteCond %{HTTP_HOST} ^(www\.)olddomain\.de$ [NC]
RewriteCond %{HTTP_HOST} !^(www\.)olddomain\.de\/backend\/$ [NC]
RewriteRule .* http://www.newdomain.de [L,R=301]
但是当我们尝试访问 www.olddomain.de/backend/ 时,我们仍然会被重定向到 www.newdomain.de。 如果不为每家商店设置重写规则,我们如何建立这一点。
感谢您的帮助。
- 第 1 行始终是 www.olddomain.de,而不是 olddomain.de,有或没有 www.
- 第 2 行不是 HTTP_HOST header,它是一个 URI。
- 第 3 行未将 URL 传递到新域
尝试将其更改为
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.de$ [NC]
RewriteCond %{REQUEST_URI} !^/backend/ [NC]
RewriteRule (.*) http://www.newdomain.de/ [L,R=301]
所以现在读
If the host is either www.olddomain.de or olddomain.de, and the requested URI doesn't begin with /backend, optionally followed by further URI details, then rewrite the host from olddomain.de to www.newdomain.de and pass the requested URI to www.newdomain.de