在不破坏旧URL的情况下更改wordpress中的URL方案

时间:2009-03-26 21:41:49

标签: wordpress url url-rewriting blogs friendly-url

我开了一个博客,经过几个帖子决定我不喜欢/ 2009 / 03/26 / foo-bar方案的URL(我换成了/ foo-bar)。但是对于在我更改之前发布的几个帖子,我想添加重写规则,以便旧URL不会中断。

我已经尝试了.htaccess文件中我想到的以下各种变体,但无济于事(注意除了“first-post”和“second-post”行之外的所有内容都是wordpress样板文件)< / p>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule /2009/03/25/first-post /first-post
RewriteRule /2009/03/26/second-post /second-post

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

有什么想法吗?

3 个答案:

答案 0 :(得分:1)

尝试Dean Lee的Permalink migration plugin

答案 1 :(得分:0)

尝试

RewriteRule ^\d*/\d*/\d*/(.*) /$1

答案 2 :(得分:0)

我刚试过的一个hacky解决方案是实际创建目录和子目录2009/03/25 / etc,然后添加一个包含以下内容的index.php文件:

<?php
header('Location: http://example.com/first-post');
?>
相关问题