mod_rewrite difficulties

mod_rewrite difficulties

Posted by: daisygirl
Posted on: 2005-04-27 12:25:00

I'm hoping someone here might be able to tell me what I'm doing wrong. I've been working from some mod_rewrite tutorials, but I don't know enough about what I'm doing to figure out why this isn't working.

Background: I just switched from Movable Type to Wordpress. I used Alex King's redirect script to get the individual entry archives to automatically redirect to the new addresses, but since I switched to using a date-based archive a while back, I'd like to make it so those URLs aren't broken, and I haven't been able to find anything that would automate the process (I couldn't get the script to work in the date-based archive template), to I'm trying to come up with with a rewrite rule to handle it.

I'm trying to redirect URLS like this: http://daisywreath.net/journal/archives/2005_04_23.html to this: http://daisywreath.net/journal/2005/04/23/

The rule I've come up with so far, which isn't working:
RewriteRule ^archives/200([0-9])]_([0-9]{2})_([0-9]{2}).html 200$1/$2/$3/ [R]

Can anyone tell me what I'm doing wrong? Any advice will be much appreciated!

Re: mod_rewrite difficulties

Posted by: macmanx
Posted on: 2005-04-27 12:30:00

Since this is a WordPress-related issue, you'll probably have better luck asking over at the WordPress Support Forums.

Re: mod_rewrite difficulties

Posted by: Atropos7
Posted on: 2005-04-27 12:37:00

RewriteRule ^archives/200([0-9])]_([0-9]{2})_([0-9]{2}).html 200$1/$2/$3/ [R]

You have an extra ] in there, before the first underscore...

RewriteRule ^archives/200([0-9])_([0-9]{2})_([0-9]{2}).html 200$1/$2/$3/ [R]


cool Perl / MySQL / HTML+CSS

Re: mod_rewrite difficulties

Posted by: daisygirl
Posted on: 2005-04-27 12:42:00

D'oh! I probably could've looked at that all day and not seen the extra bracket. It's working great now. Thank you!

Re: mod_rewrite difficulties

Posted by: macmanx
Posted on: 2005-04-27 12:43:00

Nice catch, Atropos7.

Tags: switchedurlsmodhtmlrewrite rulemovable typeappreciatedhopingaddressesbackgroundhttp