htacess重定向已经改变了子域名的行为 [英] htacess redirect has changed subdomain behaviour

查看:141
本文介绍了htacess重定向已经改变了子域名的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此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

这篇关于htacess重定向已经改变了子域名的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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