Using htaccess rewrite to make a subdirectory be its own root for root relative path requests
- by Scott
Can I use htaccess to capture requests from a certain subdirectory and make that directory use itself as the root directory for any root relative path requests? For example if I have...
http://www.example.com/subFIXED/subANY/restofpath
...where subFIXED is always the same directory, subANY is any immediate subdirectory of subFIXED, and I want a redirection of all href/src requests from any file under subANY to use subANY as the 'root' (sort of like a subdomain), in effect having root level requests use this as the root directory level:
http://www.example.com/subFIXED/subANY/
Instead of this:
http://www.example.com/
I'm assuming I can put an htaccess file in subFIXED to handle all calls coming from anything under any subANY, but not being very familiar with htaccess rewriting, variables, etc., I can't figure out how to capture which subANY directory is making the root level request and then use that capture to make a rewrite to consider that directory the root level of any root relative path requests from it.
Thanks for your help