I have a static folder which is not in my document root. I would like to redirect all the files that are not present in document root, but are present in the static folder. (So if the same file is in two places, the file that is not in the static will be served first.)
How can I do this ?
The following doesn't work:
DocumentRoot /srv/app/client/build/
Alias / /srv/app/client/static
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/
RewriteRule ^(.*)$ /$1
<Location />
Order allow,deny
Allow from all
</Location>
In your purposition, static folder is in the document root, while my document root is build which doesn't contain the static folder.
is it possible like this ? : RewriteCond %{DOCUMENT_ROOT}/../static/%{REQUEST_URI} -f RewriteRule ^(.+) %{DOCUMENT_ROOT}/../static/$1 [L]
– Dimitri Kopriwa Mar 27 '15 at 16:13