homepage Welcome to WebmasterWorld Guest from 54.197.94.241
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Character replace in mod rewrite rules
jexx




msg:3032030
 8:33 pm on Aug 2, 2006 (gmt 0)

setting up a rewrite map to 301 redirect old URLs to new as part of a site relaunch.. for the most part, i should be fine with some global rules (with a few link specific ones before as well)

however, the following got me stumped:

want to redirect

/dir1/dir2/some_widget_name.html

to

/newbasedir/dir1/dir2/some-widget-name/

the basic redirect is simple, however, spaces are replaced by underscores '_' in the old URL and need to be replaced by hyphens '-' in the new URL.

is there a way to do this replacement inline, so-to-speak?

my alternative is to just define a RewriteMap txt file with: oldURL newURL pairs.

any idea what the efficiency implications are of using RewriteMaps?

 

jdMorgan




msg:3032062
 8:57 pm on Aug 2, 2006 (gmt 0)

These previous discussions [google.com] may be useful to you.

Jim

jexx




msg:3032087
 9:15 pm on Aug 2, 2006 (gmt 0)

thanks jd, on top of things as always..
i suppose that would work, but perhpas be a bit inefficient..?

would using rewritemap URL pair lookups be faster for <500 URLs?

jdMorgan




msg:3033021
 3:14 pm on Aug 3, 2006 (gmt 0)

I can't answer that. It depends on the mix of requests to your server. It also depends on how long these incorrect URLs are expected to exist in large numbers.

Try the fast & simple approach first, and if you notice any performance problems, then use the case-by-case method.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved