K
K
Kurusa2018-10-23 12:25:15
htaccess
Kurusa, 2018-10-23 12:25:15

How to write such a rewrite rule?

I have two types of URL with and without a closing slash. For example:
www.site.com/country/requirements/test/ and www.site.com/country/requirements/test
I need to set up a 301 redirect (from pages without "/" at the end of the URL to pages with "/" in end). I tried like this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
</IfModule>

But it doesn't work because there are too many rewrite rule in my htaccess. I need a certain rule

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-11-02
@assaru

too many rewrite rules

All rules are processed in turn.
Move up the list.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question