Forum Moderators: mack

Message Too Old, No Replies

mod_rewrite to rewrite underscores to dashes

         

shanecavanaugh

2:45 am on Apr 26, 2005 (gmt 0)

10+ Year Member



How would I redirect various web pages such as /foo/bar_foo_bar/bar_foo_foo_bar.html to /foo/bar-foo-bar/bar-foo-foo-bar.php

There are multiple files with varying numbers of underscores in their URIs in the original files. Basically, I just want to convert all the underscores in a request to dashes.

I've looked around at various regexp tutorials and mod_rewrite examples and such, but can't seem to wrap my head around. So, I'd like to tail end this question with another: could someone suggest a good book to reference so that I don't have to Google like crazy every time I run into a problem? Thanks much.

jdMorgan

2:56 am on Apr 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



shanecavanaugh,

Welcome to WebmasterWorld!

How about this thread [webmasterworld.com], which answers your question directly... :)

Jim

shanecavanaugh

3:51 am on Apr 26, 2005 (gmt 0)

10+ Year Member



Thank you! For the answer and for pointing me to it.