.htaccess Drupal网站给我带来了麻烦-谷歌向subdomain.topdomain/article发送流量

.htaccess Drupal网站给我带来了麻烦-谷歌向subdomain.topdomain/article发送流量,.htaccess,drupal,.htaccess,Drupal,我在drupal 6和7中构建的两个站点上看到了这一点 谷歌发送流量到我的网站像这样 我在htaccess中尝试了几个重定向,但找不到任何内容 我希望subdomain.maindomain中的所有URL都像应该的那样重定向 子域文件(makexxxxxxxxx(dot)com位于topdomain AlterXXXXXXXXX(dot)组织的子文件夹内 这是我的URL如何在谷歌中被索引的图片,整个网站都以两种方式被索引,所以我得到了重复的内容 我想可能是我搞糊涂了,以为你想重定向一个通配符子域

我在drupal 6和7中构建的两个站点上看到了这一点

谷歌发送流量到我的网站像这样

我在htaccess中尝试了几个重定向,但找不到任何内容

我希望subdomain.maindomain中的所有URL都像应该的那样重定向

子域文件(makexxxxxxxxx(dot)com位于topdomain AlterXXXXXXXXX(dot)组织的子文件夹内

这是我的URL如何在谷歌中被索引的图片,整个网站都以两种方式被索引,所以我得到了重复的内容


我想可能是我搞糊涂了,以为你想重定向一个通配符子域,使子域成为新的请求。 无论如何,这里有两个选项(取决于您想做什么):

如果只想将子域重定向到另一个域,并保留请求的URI:

# Conditions to check for
# If HTTP_HOST
# - ends with alterxxxxxxxx.org (not case-sensitive)
#    alterxxxxxxxx\.org$ [NC]
# - AND has zero or more characters between the beginning and alterxxxxxxxx.org
#    ^(.*)
RewriteCond %{HTTP_HOST} ^(.*)alterxxxxxxxx\.org$ [NC]

# Rules to apply
# If conditions are met:
# - Redirect the whole thing to the main domain, appending the requested URI to it
RewriteRule ^ http://www.makexxxxxxxxxx.com%{REQUEST_URI} [L,R=301]
如果设置了某种通配符,并且希望将通配符转换为实际请求的URI(如我最初所想):


你的
.htaccess
文件里面写了什么?你做了什么改变吗?没有,没有任何改变这是我的htaccess这是htaccess我试过了,但它不起作用我不确定你的网站是如何设置的,但是你可以在谷歌网站管理员工具中删除URL。另外,我还对“芭堤雅很难”的文章哈哈大笑。我花了几个月的时间在这上面e、 很快就会回来;)谢谢你的这个Jerdigy但是你能改变域名吗,我不想我的网站被提及?你能做到这一点吗,我只能像在第一篇文章中那样使用XXXXXXplease@user3147837是的,没问题
# Conditions to check for
# If HTTP_HOST
# - ends with alterxxxxxxxx.org (not case-sensitive)
#    alterxxxxxxxx\.org$ [NC]
# - AND has zero or more characters between the beginning and alterxxxxxxxx.org
#    ^(.*)
RewriteCond %{HTTP_HOST} ^(.*)alterxxxxxxxx\.org$ [NC]

# Rules to apply
# If conditions are met:
# - Redirect the whole thing to the main domain, appending the requested URI to it
RewriteRule ^ http://www.makexxxxxxxxxx.com%{REQUEST_URI} [L,R=301]
# Conditions to check for
# If HTTP_HOST:
# - ends with alterxxxxxxxx.org (not case-sensitive)
#    alterxxxxxxxx\.org$ [NC]
# - AND has at least 1 non-dot followed by a single dot before alterxxxxxxxx.org
#    ([^.]+)(\.)
# - AND (OPTIONALLY) has www. at the very beginning
#    ^(www\.)?
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)(\.)alterxxxxxxxx\.org$ [NC]

# Rules to apply
# If conditions are met:
# - Leave the www. out of everything, regardless of whether it was found or not
#    %1
# - Leave the dot between the wildcard and alterxxxxxxxx.org out of everything
#    %3
# - Use the characters that come before the dot (%3) and after the optional www. (%1)
#    %2
# - Tell the browser or Google or whoever is visiting that the redirect is permanent
#    R=301
RewriteRule ^ http://www.makexxxxxxxxxx.com/%2 [L,R=301]