Wordpress Redirect子目录到子域

时间:2012-06-22 22:30:14

标签: redirect

我们刚刚将一个WPML网站从example.com/fr迁移到了fr.example.com。

我想保留所有链接汁,所以我正在尝试重定向所有链接

www.example.com/fr/mylink - > fr.example.com/mylink /

这是我现在所拥有的,但它不起作用:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^([^.:]+\.)*example\.com/fr\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://fr.example.com/$1 [R=301,L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

该网站仍然运行良好,但重定向无法正常工作。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

尝试通过FTP访问网站 尝试将代码添加到您的wp-config.php文件中

define('WP_HOME', 'http://www.example.com');
define('WP_SITEURL', 'http://www.example.com/wordpress');

这对我有用。 在您的网站上试试。