D
D
Dirion2019-06-26 20:55:13
htaccess
Dirion, 2019-06-26 20:55:13

RewriteRule: how to add file exclusion?

Hello.
htaccess content:

RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^.*$ index.php [L]

How to add a rule to exclude multiple files from redirect rules?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dirion, 2019-06-27
@Dirion

RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ index.php [L]

The last line has been changed.
Redirect to everything except addresses where there is a dot.
Perfect solution.

V
Viktor Taran, 2019-06-26
@shambler81

RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteRule ^.*$ index.php [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question