Answer the question
In order to leave comments, you need to log in
Apache Mod_Rewrite - how to force stop after RewriteRule fire?
I have:.htaccess:
RewriteEngine On
RewriteRule ^/image/.+$ imageWrapper.php [L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
— standard from distribution of Zend Framework 1+ plus my rule for /image/; http://localhost/image/w/150/h/150/sertificate.jpg
, the imageWrapper.php script is executed, into which REQUEST_URI /image/w/150/h/150/sertificate.jpg is passed, after which the script successfully completes and dies. Answer the question
In order to leave comments, you need to log in
He asked, he answered. You must use the condition:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/image\/.*$
RewriteRule ^.*$ imageWrapper.php [NC,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
If you have a loaded application and Nginx works before Apache, then it is better to transfer these rules there. Otherwise it turns out Nginx → Apache → .htaccess
I tried to do this, for redirects it turns out several times faster, but you need to know what to write in Nginx, and even without IFs (because they are evil )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question