本文介绍了将域名重定向到同一域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将以下域名:haloservers.net,haloservers.nl和servers.xgclan.com重定向到域名www.haloservers.us我尝试将代码放在htaccesses文件中,但这没用.
I want to redirect the following domain names :haloservers.net,haloservers.nl and servers.xgclan.com to the domain name www.haloservers.usI tried putting the code below in the htaccesses file but this didn't work.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.?)haloservers.net$
RewriteRule ^(.*)$ http://www.haloservers.us/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.?)haloservers.nl$
RewriteRule ^(.*)$ http://www.haloservers.us/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(servers\.)xgclan.com$
RewriteRule ^(.*)$ http://www.haloservers.us/$1 [R=301,L]
推荐答案
以下代码解决了该问题.
The following code fixed the problem.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)haloservers(.nl|.net)$
RewriteRule ^(.*) http://www.haloservers.us/$1 [L,R=301]
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?haloservers(.nl|.net) [NC]
RewriteRule ^(.*)\.html$ http://haloservers.us/$1 [R=301,L]
我从col-dejong @ http://gathering.tweakers.net获得了解决方案/forum/list_messages/1497390/last
I got my solution from col-dejong @ http://gathering.tweakers.net/forum/list_messages/1497390/last
这篇关于将域名重定向到同一域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!