views:

21

answers:

1

I'm struggling to write a .htaccess file.

I need to redirect addresses such as:

/archives/YYYY/MM/post-name

to

/blog/post-name

Any help would be appreciated!

+1  A: 

Make sure your rewrite engine is on:

RewriteEngine on
RewriteRule ^/archives/([^/]*)/([^/]*)/([^/]*)/?$ /blog/$3 [L] 

You can narrow it down by using {0-9,4} for the year and {0-9,2} for the month.

Snake