I have a problem with an old project for which I have the following mod_rewrite conditions/rules:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
But .phtml files are being rendered as plain text in the browser.
The problem is that I have some .phtml files within a public directory that are matching the first rewrite condition '-s' (is regular file, with size) and so they're not getting sent to index.php. In fact, the .phtml files are showing as plain text! I need to keep those files there so I can't set deny from all
for that directory because it also contains some images and stuff.
I tried this:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteRule \.phtml$ index.php [NC,L]
But it didn't work because it already met the first rewrite condition, so the first rule got applied (to do nothing).
How can I get around that?
\.phtml$
rule first...? – DaveRandom Dec 9 '11 at 8:57