I am trying to improve the SEO for one of my sites. The current URL structure is like this: http://www.example.com/1.html http://www.example.com/2.html The software I am using allows to instantly switch to the following format: http://www.example.com/article/subject-line-title.html That way I will have keyword enriched URLs. Now I want to redirect the old URLs with a 301 redirect to the new ones. Problem is that I have more than 300 pages that need a redirect. While I can create those manually, I am concerned what it does to the file size of my .htaccess file and website performance. The .htaccess file contains rules where the old URLs redirect to the dynamic URL which would be default. Now I am wondering if I can use that redirect to dynamically create the 301 redirect. Example (old): RewriteRule ^([0-9]+)-([0-9]).html /index.php?art/id:$1,offset:$2 [L] RewriteRule ^([0-9]+).html /index.php?art/id:$1 [L] New rules to generate the keyword enriched URLs: RewriteRule ^article/([0-9a-z-]+)_([0-9]).html /index.php?do=art&id=$1&offset=$2 [L] RewriteRule ^article/([0-9a-z-]+).html /index.php?do=art&id=$1 [L] How can I have the generic rule from the first set point to the second one in a 301 redirect? I tried the following, but that did not work at all: Redirect permanent /([0-9]+).html http://www.example.com/article/([0-9a-z/-]+).html The .htaccess rules for the new URLs are covered in all these: RewriteRule ^article/([0-9a-z/-]+)_([0-9]).html /index.php?do=art&id=$1&offset=$2 [L] RewriteRule ^article/([0-9a-z/-]+).html /index.php?do=art&id=$1 [L] RewriteRule ^article/([0-9a-z-]+)_([0-9]).html /index.php?do=art&id=$1&offset=$2 [L] RewriteRule ^article/([0-9a-z-]+).html /index.php?do=art&id=$1 [L] I am just not experienced enough to get this sorted out properly. Any help would be appreciated. Thanks. Christoph
Your current setup from the post... you'll should try something like Just remember that you can't use a database or anything to supply dymanic data to apache (with some extremely advanced settings). if you want it to fully redirect to the keyword rich url, it would be best to modifiy index.php to detect the old url, and get the new url, and use php to 302 redirect, my 2c worth =)