将某些内容从子域重定向到其他域

时间:2019-07-16 15:38:16

标签: php wordpress .htaccess

即使这与Wordpress有关,但该概念距离本文足够远。

我有一个子域:blog.bla.com 我在此子域上有数百篇文章,需要将其中一些重写到新域中:bla.com/newPosts

使用.htaccess 301重定向我对该主题的研究表明,我应该能够简单地说:

Rewrite 301 "blog.bla.com/test/article" "bla.com/test/article

但这不起作用。 Wordpress可用的(php)插件也无法在子域/域之间转移。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

将此规则添加到blog.bla.com .htaccess文件的顶部

RewriteEngine On
RewriteRule ^test/article$  http://bla.com/test/article  [R=301,L]
RewriteRule ^test/article2$ http://bla.com/test/article2 [R=301,L]
RewriteRule ^test/article3$ http://bla.com/test/article3 [R=301,L]
相关问题