I've trouble comprehending the rewrite rules. I have attempted a few, but none of them appears to operate.
I've got a folder let us say in root/private/images/ that I wish to be utilized using http://website/private_images/. This site has been offered from root/public/, that ought to be in which the .htaccess file is.
I'd need something similar to i guess (which does not work):
RewriteRule private_images/(.*) ../private/images/$1
This will work, because I am doing something similar to you need to do and delay pills work perfectly on my small website (not launched yet sorry you cannot view it).
Here's the way i get it done:
# ...test if file exists in partner dir :
RewriteCond %{DOCUMENT_ROOT}/../partnerdir/%{REQUEST_FILENAME} -f
# file exists => rewrite + end :
RewriteRule (.*) %{DOCUMENT_ROOT}/../mypath/%{REQUEST_FILENAME} [QSA,L]
Let me know whether it works.
Two hints:
Please use the RewriteLog
directive: it allows you to find such problems:
# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On
My personal favorite tool to check on for regexp:
http://www.quanetic.com/Regex (be sure to choose ereg(POSIX) rather than preg(PCRE)!)
May I request you to definitely add the rewritelog inside your question?
In my opinion the main reason this does not jobs are that Apache translates the 2nd argument like a URL, however it can't resolve ../
in accordance with the main of the site.
The best way to handle this setup would be to place the lines
Alias /private_images /path/to/root/private/images
<Directory /path/to/root/private/images>
Order allow,deny
Allow from all
</Directory>
inside your virtual host configuration.
Without having accessibility virtual host configuration, place the
RewriteRule /private_images(/.*) /path/to/root/private/images$1
within the .htaccess
file.