Php .htaccess导致无休止的循环,无法使用博客将.net重写为.com

Php .htaccess导致无休止的循环,无法使用博客将.net重写为.com,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,我有一个带有.com和.net的域,它们都指向同一个位置。我需要主站点和博客都映射到一个url,因为谷歌正在抨击我重复的内容。这是一个PHP网站和Wordpress博客 最终目标是将这两个集合中的每一个重写为两个不同的URL。这可能吗?如果不可能,请有人推荐我最接近的选项吗?或者我应该取消.net .com是主站点,.net停在同一物理位置 otown411.com www.otown411.com otown411.net www.otown411.net ------------------

我有一个带有.com和.net的域,它们都指向同一个位置。我需要主站点和博客都映射到一个url,因为谷歌正在抨击我重复的内容。这是一个PHP网站和Wordpress博客

最终目标是将这两个集合中的每一个重写为两个不同的URL。这可能吗?如果不可能,请有人推荐我最接近的选项吗?或者我应该取消.net

.com是主站点,.net停在同一物理位置

otown411.com
www.otown411.com
otown411.net
www.otown411.net
--------------------
otown411.com   <--- **goal rewrite of any 4 above**


blog.otown411.com
blog.otown411.net
www.otown411.com/blog
www.otown411.net/blog
otown411.com/blog
otown411.net/blog
---------------------
blog.otown411.com  <--- goal rewrite from any six above

这应该可以做到:

Options +FollowSymLinks
RewriteEngine on
# Handle Blog first

RewriteCond %{HTTP_HOST} !^blog\.otown411\.com [NC] # check we're not where we want to be
RewriteCond %{HTTP_HOST} ^blog\. [NC,OR] # only if subdomo is blog OR...
RewriteCond %{REQUEST_URI} .*blog/.* [NC] # blog/ is in the URL
RewriteRule ^(blog/)?(.*?)$ http://blog.otown411.com/$2 [R=301,QSA,L]

# Now handle the rest

RewriteCond %{HTTP_HOST} !^blog\.otown411\.com [NC] # don't process for blog nor
RewriteCond %{HTTP_HOST} !^otown411\.com$ [NC] # if we're already on otown411.com
RewriteRule ^(.*)$ http://otown411.com/$1 [R=301,NC,QSA,L] 

我今天一定花了两个小时来处理这件事,而你做得非常完美,足以投票了。唯一不同的是:www.otown411.com/blog变成了otown411.com/blog,但我很高兴,谷歌现在应该这样。TYVM
Options +FollowSymLinks
RewriteEngine on
# Handle Blog first

RewriteCond %{HTTP_HOST} !^blog\.otown411\.com [NC] # check we're not where we want to be
RewriteCond %{HTTP_HOST} ^blog\. [NC,OR] # only if subdomo is blog OR...
RewriteCond %{REQUEST_URI} .*blog/.* [NC] # blog/ is in the URL
RewriteRule ^(blog/)?(.*?)$ http://blog.otown411.com/$2 [R=301,QSA,L]

# Now handle the rest

RewriteCond %{HTTP_HOST} !^blog\.otown411\.com [NC] # don't process for blog nor
RewriteCond %{HTTP_HOST} !^otown411\.com$ [NC] # if we're already on otown411.com
RewriteRule ^(.*)$ http://otown411.com/$1 [R=301,NC,QSA,L]