Adam Fletcher Adam Fletcher - 1 year ago 66
PHP Question

WordPress .htaccess RewriteRule not working

Relaunched a website and a lot of old pages need to be redirected to new ones.

I thought this would be simple with htaccess but wordpress has other ideas.
Htaccess's 'Redirect 301' doesn't appear to be supported with all the stuff wordpress does. A lot of forums and posts suggest 'RewriteRule'.

Here is the htaccess code I am working with in the root directory. My code is the two lines starting with 'RewriteBase /'.
I hoped that by going to http://www.example.com.au/skps/contact.html it would redirect me to http://www.example.com.au/about/ .
This just does not work.

DirectoryIndex index.html index.htm index.php

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
#
RewriteBase /
RewriteRule ^skps/contact.html$‎ http://www.example.com.au/about/ [R=301,L]
#
RewriteBase /digiseen/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /digiseen/index.php [L]
</IfModule>

# END WordPress

Answer Source

While this doesn't directly answer your question, I've had better luck using the Redirection plugin for this sort of thing.

It's pretty easy to use, and when I'm doing a redesign or changing site structure I use this plugin for a few months (until the search engines have re-indexed the site). Of course, you can leave it on indefinitely if you wish.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download