【发布时间】:2015-02-14 21:23:25
【问题描述】:
我正在将 MovableType 博客迁移到 Wordpress。
所有旧帖子的网址都以 .html 结尾。
例子:
http://ec2-174-129-85-183.compute-1.amazonaws.com/archives/2013/12/all_quiet_on_th.html
但是,当我在 wordpress 中更新帖子名称以包含 .html 扩展名时,我不断收到 404 错误。
所以我现在要做的是将所有以 .html 结尾的页面的请求重定向到相同的页面,但没有 .html。
例如:
.../archives/2013/12/all_quiet_on_th.html
301 会重定向到:
.../archives/2013/12/all_quiet_on_th
这是我当前的 .htaccess 文件:
# BEGIN WordPress
# Ensure the rewriet module is loaded
<IfModule mod_rewrite.c>
# enable the rewrite engine
RewriteEngine On
# Set the root directory
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
您能否告知我可以对此文件进行哪些更改才能使其正常工作?
我已经在互联网上尝试了 5 或 6 个不同的版本,但都不起作用,我不知道为什么。
【问题讨论】:
标签: regex wordpress apache .htaccess mod-rewrite