Tag Archives: modrewrite

lazyweb request: help with some url re-writing kung fu

update II: looks like this might be an issue only on my version of chrome running on windows? i have a report that another person running the same version of chrome redirects fine. weird. how about this. if it’s not working you leave a comment 🙂

update: i guess this might be limited to an issue on chrome on windows? still looking for a solution that works across all platforms.

as happens when you’ve been writing online for a long time, i’ve made some changes over the years that requires modifying urls on the fly to keep from serving “page not found” errors. on set of changes involves stripping out .html from the filename and removing part of the url.

so, for instance the url http://snowdeal.org/section/ex_machina/2004/07/pregnancy-update-born-on-fourth-of.html will automatically change to http://snowdeal.org/2004/07/pregnancy-update-born-on-fourth-of/ ( see that change? ).

it works, for example on the above line but not on http://snowdeal.org/section/ex_machina/2004/07/eric-update-day-21-otherwise-known-as.html even though if i apply the logic by removing the html and “section/ex_machina/” the url will resolve just fine. any suggestions. here’s the mod rewrite rules that i kludged together that work somebutnotall of the time.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
RedirectMatch /section/ex_machina(/.*) $1

this has been one of those nagging things that’s been bugging me for years. i’m pretty sure this is going to end with me feeling pretty stupid but that’s never stopped me before!