Answer the question
In order to leave comments, you need to log in
How to direct all requests to one file?
Good afternoon. There is a certain file: index.php
And it is necessary that all requests, regardless of the url, be sent to it, except for those requests where file permissions are specified, for example:
mydomian.com/users/ - redirects to index.php
mydomian.com/users.html - redirects to users.html
mydomian.com/images/contacts.png - redirects to contacts.png
mydomian.com/images/awdawd?value=adawd&value_2=adawd - redirects to index.php
Please help me.
Answer the question
In order to leave comments, you need to log in
If there is no such file or directory on the server, then everything will go to index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
RewriteEngine on
RewriteRule [%,a-zA-Z0-9/-/+/()] index.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question