Forum Moderators: phranque
I'm attempting to internally rewrite (root relative request):
GET /images/sect1/thisimage.jpg - to -
/siteB_v10/images/sect1/thisimage.jpg
What I'm stumped with is how I capture the subdirectory variable (because RewriteCond just tests, doesn't capture?) and pass it to the RewriteRule when it's not in the GET request being made and I haven't been able to connect with/see this in the myriad of examples around. I believe the information is in REQUEST_FILENAME, is that correct? Is this even possible with mod_rewrite or should I be looking at another way - say.. just redirect everything to a php script that will sort it out?
Thanks for stopping by.
It's not clear from your post what the significance of the bolded "/siteB_v10/" path-part is. It does not appear necessary to use a RewriteCond for your application, as the RewriteRule itself can check the full requested URL-path as long as the code is located at "/.htaccess" rather than in a subdirectory below that. If the code is located in a subdirectory, then things get a bit more complicated, requiring a check of THE_REQUEST and the setting and testing of a "user-variable" (see RewriteRule [E=var:val] flag) to prevent an 'infinite' rewriting loop.
That's the extent of the useful comments I can make without seeing a code example and a more-thorough description of the goal, the relevant URL-paths and file-paths, and the exact problem with the attempted coded solution.
Jim
I'm sorry for the lack of clarity., entirely due to the fact I'm struggling somewhat. The bolded subdirectory name I think was because it's going to be highly variable (though not on a GET request by GET request basis) only on a 'as archived' basis.. if... that is any clearer.
The .htaccess is at root level and it is being processed, I've established that.
I'm going to take away what you've said if you don't mind, as I feel I understand something I didn't before, and revisit my .htaccess experiments. See if I can achieve my aim without taking up any more of your time. Either way, I'll come back and post.. whether success or failure and will welcome comments on either outcome.
Many regards
Roan
If the "/siteB_v10/" value is tucked away in some "session-management" system, then things are likely to get complex and require a scripted solution.
Jim