How to rewrite using htaccess if the file exists in another folder?
- by Jack
We are trying to rewrite to another folder if the file does not exist in the document root, but does exist in the other folder.
The other folder is in a completely different location, which is located using "Alias" in the vhosts.
So, what we have so far (from this post How to rewrite URI from root if file exists in folder?) is:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/legacy/
RewriteRule ^(.*)$ legacy/$1 [QSA,L]
This works to an extent, but seems to direct everything to the legacy folder, not just when the file doesn't exist in the first location and does exist in legacy.
Thanks in advance for any help,
Jack.