0

我有一个类似的域:this.that.com(也可以从:) that.com/this 访问

我想做的是让服务器将所有请求从上述两个网址传输到:this.com

我需要它,所以如果我输入 this.that.com,它会自动转移到 this.com

提前致谢。

4

1 回答 1

1

要将所有请求重定向到this.com,匹配所有内容,这还不是this.com

RewriteEngine On
RewriteCond %{HTTP_HOST} !^this\.com$
RewriteRule .* http://this.com/$0 [R,L]

如果您想重定向到主页,请忽略 URL 路径

RewriteEngine On
RewriteCond %{HTTP_HOST} !^this\.com$
RewriteRule .* http://this.com/ [R,L]

如果一切正常,您可以切换到R=301重定向。

于 2013-01-23T01:49:56.143 回答