Topic: [OK] Unable to check file existence using RewriteCond in Apache
Update: Problem (might be) solved! My complete .htaccess can be found in the last post. I am still not sure if the full web path might change in the future, but it works for the moment. The following is my old question:
Hello everybody!
First of all I want to thank everyone at TuxFamily for an amazing service! Apart from the usual project hosting (like git and download repository), the website features (like php and mysql) are simply unbelievable!
Now to the problem:
I decided to try to implement caching to the website for my project, in order to minimize database and php usage. While the website is lightweight and got few visitors I still want to do as much as I can to minimize any load. When the (php generated) pages are visited, static pages are created in a subdirectory called "cache" and the plan is to check for existence of these static files using RewriteCond in ".htaccess" and redirect to them using RewriteCond.
In short: I have been able to successfully check for file existence using:
RewriteCond ${REQUEST_FILENAME} -fBut since I need to check for files in a modified path (the static files are stored in a subdirectory), I need to use the %{DOCUMENT_ROOT} and ${REQUEST_URI} variables (to add "/cache/" between).
The problem is: when trying to use "RewriteCond" without ${REQUEST_FILENAME} it always seems like the file is missing. For example, replacing the above with:
RewriteCond %{DOCUMENT_ROOT}${REQUEST_URI} -fShould (in most cases) produce the same behaviour, but instead fails for me.
I'm suspecting this might be an intentional security feature, but I thought I would ask and see if I were doing something wrong?
Thanks Again!