How to redirect with .htaccess (keeping legacy links)

Posted by Laurent on Stack Overflow See other posts from Stack Overflow or by Laurent
Published on 2011-01-15T23:08:02Z Indexed on 2011/01/15 23:53 UTC
Read the original article Hit count: 132

Filed under:

Hello, I recently switched CMSes.

While using Wordpress, I had this permalink convention: "/year/post". Now, I'd like to have "year/month/post".

To keep legacy links, I need to redirect from "http://site.com/2009/sample-post" to "http://site.com/2009/01/sample-post". "01" should be permanent in this case.

This is what I've got atm:

RewriteEngine on 
RewriteCond $1 !^(images|system|themes|_|wp-content|mint|assets|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]

Thanks in advance!

© Stack Overflow or respective owner

Related posts about .htaccess