1

我创建了一个博客,在几篇文章之后我决定我不喜欢 /2009/03/26/foo-bar 的 URL 方案(我改为只是 /foo-bar)。但是对于在我更改此内容之前发布的几篇帖子,我想添加重写规则,这样旧的 URL 就不会中断。

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

# 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

有任何想法吗?

4

3 回答 3

1

试试 Dean Lee 的Permalink 迁移插件

于 2009-04-08T10:34:39.883 回答
0

尝试

RewriteRule ^\d*/\d*/\d*/(.*) /$1
于 2009-03-26T21:44:41.150 回答
0

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

<?php
header('Location: http://example.com/first-post');
?>
于 2009-03-26T21:47:24.390 回答