Answer the question
In order to leave comments, you need to log in
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>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question