S
S
SET12020-09-12 17:56:13
htaccess
SET1, 2020-09-12 17:56:13

How to transfer all requests to index.php through htaccess, except for 404?

I need all requests to be redirected to index.php, and in case of a response, the server 404 is redirected to 404.html.

Tried like this:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/templates/
RewriteCond %{REQUEST_URI} !^/uploads/
RewriteCond %{REQUEST_URI} !^/panel/
RewriteCond %{REQUEST_URI} !^/ajax/

ErrorDocument 404 /404.html

RewriteRule ^((?!index\.php).+)$ /index.php [L]


But when the server responds with a 404 code, nothing happens.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question