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



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

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

makexxxxxxx.alterxxxxxx(dot)org/zeveracom-xxxxx
and it should be
http://makexxxxxxxxxx(dot)com/zeveracom-xxxxxxxx

我在htaccess中尝试了几次重定向,找不到任何东西

我希望来自子域.maindomain的所有网址都被重定向到它们应该的样子

子域文件(makexxxxx(dot)com位于topdomain alterxx(dot)org的子文件夹中

这是我的网址在谷歌中被索引的图片,整个网站都以两种方式编入索引,所以我得到重复的内容!!

https://www.dropbox.com/s/fvh3kz65lu62fr8/Capture.JPG

我想也许我感到困惑,并认为您想重定向通配符子域,使子域成为新请求。无论如何,这里有两个选项(取决于你想做什么):

如果只想将子域重定向到其他域,请保留请求的 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(就像我最初认为的那样):

# 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]

最新更新