M
M
maks789452019-10-17 12:06:27
htaccess
maks78945, 2019-10-17 12:06:27

How to add another rule to htaccess?

Good afternoon!
I found such a simple redirect that adds / at the end if it is not there.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

Everything works, but you need to add one more rule so that, for example, for files that are stored in the admin folder and subfolders, the rule does not work.
I tried to add this value, it didn't work: "RewriteCond %{REQUEST_FILENAME}/admin/ !-f"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-10-17
@maks78945

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin/
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question