.htaccess重写规则不适用于不同的页面

时间:2011-09-06 06:13:16

标签: wordpress mod-rewrite

我的页面名称为-book.html,但现在我将页面名称更改为about-the-book。我已经将重写规则用作

`Redirect 301 /the-book.html http://www.xxx.com/about-the-book.html`

但它不起作用。

我的完整.htaccess代码在这里

RewriteRule ^/the-book.html$ http://www.xxx.com/about-the-book.html [R=301]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

2 个答案:

答案 0 :(得分:1)

RewriteRule ^the-book.html$ http://www.example.com/about-the-book.html [R=301]

答案 1 :(得分:0)

不确定Redirect指令,但

RewriteRule ^the-book.html$ http://www.xxx.com/about-the-book.html [R=301]

应该很好用。

编辑: 删除了匹配部分中的前导/

相关问题