Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I had made the page the-book.html in wordpress site, later changed the name to about-the-book, now i have written the .htaccess file as

**RewriteRule ^the-book.html$ http://www.conversationissexy.com/about-the-book/ [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

but it doesn't works..

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

1. Try adding [L] flag next to R=301 -- right now redirect will not occur straight away and URL gets processed by other rules (the WordPress block). The L flag in conjunction with R=3xx tells Apache to execute such redirect immediately:

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

This should do the job.

2. If still nothing -- move the above rule inside WordPress block and place just after RewriteBase line:

# BEGIN WordPress
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /

   # your redirect rule
   RewriteRule ^the-book.html$ http://www.conversationissexy.com/about-the-book/ [R=301,L]

   # actual WordPress rules
   RewriteRule ^index\.php$ - [L]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule . /index.php [L]
</IfModule> 
# END WordPress

3. Alternatively, use RedirectMatch directive instead of RewriteRule so you can keep your redirect rule where it is right now:

RedirectMatch 301 ^/the-book.html$ http://www.conversationissexy.com/about-the-book/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.