开发者

.htaccess rewrite rule not working for different pages

开发者 https://www.devze.com 2023-04-02 11:21 出处:网络
I had the page name as the-book.html, but now i changed the page name to about-the-book. I have used the rewrite rule as

I had the page name as the-book.html, but now i changed the page name to about-the-book. I have used the rewrite rule as

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

but it is not working.

my full .htaccess code is here

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 %{REQU开发者_Go百科EST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


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


Not sure about the Redirect directive, but

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

should work nicely.

Edit: Removed the leading / in the match part.

0

精彩评论

暂无评论...
验证码 换一张
取 消