2011-09-06 118 views
0

我的页面名称为-book.html,但现在我将页面名称更改为约书。我使用了重写规则,因为.htaccess重写规则不适用于不同的页面

`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 
+0

'RewriteEngine On'和'RewriteBase /'需要在任何**'RewriteRule'之前。 –

回答

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

不能确定Redirect指令,但

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

应该很好地工作。

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

+0

为什么这不是被接受的答案? – Binod