Answer the question
In order to leave comments, you need to log in
htaccess: why can't the rule work?
There is a site with one entry point. There is a rule in htaccess in which all requests for non-existent files are redirected to index.php. In order not to litter the logs with erroneous requests for statics, I wanted to prohibit this business. Wrote a rule.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} \.(gif|jpg|png|ico|css|js|swf|wav|mp3|less|cur)$ [NC]
RewriteRule .* - [L,R=404]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php [L]
Answer the question
In order to leave comments, you need to log in
htaccess rules for static can be ignored if nginx gives the static
Try this way:
And here is a cheat sheet for you just in case mod_rewrite cheat sheet
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question