I have a site that I just redid and I want to 301 redirect all old URL's to the new ones.
The old site was: /keyword_keyword_keyword.html the new site is /keyword-keyword-keyword/
So I'm trying to replace underscores with dashes and then replace the .html with a forward slash.
I have this:
It does not seem to be working as old URL's redirect to the front page. Any advice is appreciated.Code:DirectoryIndex index.php index.html # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress # BEGIN 301 Redirects # REPLACE one underscore at a time until there is one or less left RewriteRule ^([^_]*)_([^_]*_.*) $1-$2 [N] # REPLACE the last underscrore and do an external redirect RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301] # Replace .html with a / RedirectMatch 301 (.*)\.html$ http://http://www.website.com/$1/ # END 301 Redirects




Reply With Quote
Bookmarks