htacess重定向已经改变了子域名的行为重定向、行为、改变了、域名

2023-09-02 00:56:40 作者:做你怀中猫

使用此code写一个301重定向后:

After writing a 301 redirect using this code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^aicolchesterpersonaltrainer.co.uk$
RewriteRule (.*) http://aicolchesterpersonaltrainer.co.uk/$1 [R=301,L]
ErrorDocument 404 http://aicolchesterpersonaltrainer.co.uk/404ErrorPage.htm

我的域www.ai-total-fitness.com现在有preFIX HTTP: //aicolchesterpersonaltrainer.co.uk/wsb5841134301/ ,这虽然是地方文件的网站:艾总,健身,所有的链接现在指向其他网站,我猜这是因为重定向规则,任何人都可以提出正确的code排除ai-total-fitness.com网站和文件好吗?

My domain "www.ai-total-fitness.com" now has the prefix "http://aicolchesterpersonaltrainer.co.uk/wsb5841134301/" which although that is where the files are for the website : ai-total-fitness, all the links now point to the other site, I'm guessing this is due the redirect rule, can anyone suggest the correct code to exclude the ai-total-fitness.com site and files please?

该aicolche〜网站是在根文件夹,艾总,健身站点是一个文件夹内的目录

The aicolche~ site is in the root folder, and the ai-total-fitness site is within a folder in that directory

推荐答案

要排除 ai-total-fitness.com ,添加另一个条件:

To exclude ai-total-fitness.com, add another condition:

RewriteCond %{HTTP_HOST} !^(www.)?ai-total-fitness.com$ [NC]

,这样它看起来像

so that it looks like

RewriteEngine On
RewriteCond %{HTTP_HOST} !^aicolchesterpersonaltrainer.co.uk$ [NC]
RewriteCond %{HTTP_HOST} !^(www.)?ai-total-fitness.com$ [NC]
RewriteRule (.*) http://aicolchesterpersonaltrainer.co.uk/$1 [R=301,L]
ErrorDocument 404 http://aicolchesterpersonaltrainer.co.uk/404ErrorPage.htm