【发布时间】:2015-02-05 13:02:59
【问题描述】:
一个新客户需要我的帮助,他们的网络开发人员搞砸了 - 在草稿/测试服务器上建立了网站,但忘记阻止 Google 等。我希望在这里为社区提供帮助,我不是 HTACCESS 重定向方面的专家。
正如我所说,另一个网站开发人员在他们的草稿服务器上设置了客户草稿网站,它已经存在了几个月,但是他们忘记将其隐藏在搜索引擎中,因此内容已被 Google 等索引 - 这将触发如果 web 将新网站上线,则重复内容惩罚,新网站将无效。
我可以访问草稿站点/服务器,并且可以修改 HTACCESS 文件,因此当新站点上线时,我希望有正确的重定向。网站上有几个子域(它是一个多语言网站),所以有点棘手。
网站建立在 Wordpress 之上
网站结构在测试服务器上如下所示。所有文件页面名称和文件名都相同,只是移动到新服务器。
http://clientdomain.testserver.com
http://it.clientdomain.testserver.com
http://fr.clientdomain.testserver.com
http://es.clientdomain.testserver.com
http://de.clientdomain.testserver.com
http://ko.clientdomain.testserver.com
http://pt.clientdomain.testserver.com
http://ru.clientdomain.testserver.com
http://tr.clientdomain.testserver.com
http://cn.clientdomain.testserver.com
重定向需要到这里:
http://clientdomain.com
http://it.clientdomain.com
http://fr.clientdomain.com
http://es.clientdomain.com
http://de.clientdomain.com
http://ko.clientdomain.com
http://pt.clientdomain.com
http://ru.clientdomain.com
http://tr.clientdomain.com
http://cn.clientdomain.com
测试服务器上现有的 HTACCESS 文件如下所示
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
我非常感谢您对此的任何帮助。
有一些现有的线程包含 HTACCESS 拼图的所有部分,但我有点困惑:
如何在 .htaccess 中从一个子域重定向到另一个子域? How can I redirect from one subdomain to another in .htaccess?
亲切的问候, GG
【问题讨论】:
-
以后不用去clientdomain.testserver.com了吗?
标签: php wordpress apache .htaccess redirect