Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Subscribe to WebmasterWorld
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.