Answer the question
In order to leave comments, you need to log in
RewriteRule. How to redirect all requests except resources?
All requests like example.com/cars/bmw/x6 should be redirected to special. file, let it be index.php .
BUT, all requests for resources, css, js, img (all formats) must be "taken" directly.
Is it possible to do this in .htaccess without listing all formats.
Sample rule . If the URL has a dot before the question mark ( ? ), then directly, otherwise let it redirect.
Directly:
*/index.php?get_json=1&data=blabla
*/style.css, */script.js - - - - - - - - - // dot before - ? , if the sign itself is absent, then we consider that it is the last
Redirect:
*/people/1 - - - - - - - - - // no dot before - ?
Answer the question
In order to leave comments, you need to log in
Standard code for such things
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
Answer received! Thanks gracer Have
n't marked it as a solution yet , read what I wrote to him, question about [L] and %{REQUEST_FILENAME} (!-f, !-d)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question