mod_rewrite problem

Hi,

I have a problem with mod rewrite. What i need to do is basicly to hide a folder from the URL. Now the following code works, as long as I work in the root folder:

RewriteCond %{REQUEST_URI} !v2/
RewriteCond %{DOCUMENT_ROOT}/v2%{REQUEST_URI} -f
RewriteRule .? v2%{REQUEST_URI} [L]

This means that if i go www.mysite.com/fileInv2.php then in reality i get the file www.mysite.com/v2/fileInv2.php

Which is great. However, what I need to do now, is to do it in a sub folder. What I got is this:
www.mysite.com/farms/v2/fileInv2.php
which should be converted into:
www.mysite.com/farms/fileInv2.php

However, I cannot get this to work (placing the .htaccess file inside of the farms folder).

Your help is much appreciated! :slight_smile:

az,

EASY! Remove the v2 directory and elevate the level of its files.

Okay, if that’s not acceptable, then redirect every request of the v2 directory to the non-v2 version (R=301) then Redirect to the v2 version (hidden).

Regards,

DK

Hi,

Yes I cannot remove the v2 directory. Not sure what you want me to do above though? (really sucky at mod_rewrite…)

Check out the article in dklynn’s signature.
Everything should become a lot more clear from that. If it doesn’t, feel free to come back with additional questions :slight_smile: