homepage Welcome to WebmasterWorld Guest from 54.167.185.110
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

    
Redirect Images Directory With htaccess + variable in path
u4eas




msg:4483736
 11:21 pm on Aug 10, 2012 (gmt 0)

Ok... htaccess I love it and hate it.

I have to create a htaccess redirect for multiple image directories within a path to a root level image directory. The paths all have a variable within them though, in my case a directory named after a city/state...

We have a number of mini sites within our corp site, each mini site has its own image directory: .../images/u/whatever.jpg

Examples:
root/store/local/birmingham-al/images/u/
root/store/local/mongomery-al/images/u/
root/store/local/nashville-tn/images/u/

I want to redirect all images from each of the /images/u/ to:

root/newimagedir

How can I do it so I only effect images in those /images/u/ directories?

Thanks in advance.

 

g1smd




msg:4483739
 11:34 pm on Aug 10, 2012 (gmt 0)

Write the RegEx pattern for the rule so that it selects the one you want to redirect and does not select the ones you don't. If necessary add an additional RewriteCond looking at REQUEST_URI.

You'll end up with a ruleset that works when URL "begins with this" but does "not contain this", or similar.

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