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

10+ Year Member

Msg#: 4483734 posted 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


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


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

Thanks in advance.



WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 4483734 posted 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