A
A
Alex Sokol2018-09-24 17:03:56
1C-Bitrix
Alex Sokol, 2018-09-24 17:03:56

How to redirect from a link that does not have a slash at the end to a page that has a slash at the end?

How to redirect from a link that does not have a slash at the end to a page that has a slash at the end?
/salons/bagira-60857 to /salons/bagira-60857/
well, this is an example
in order not to duplicate pages in the search
options .htaccess or urlrewrite.php or rel="canonical"
put in .htaccess
RewriteCond %{REQUEST_URI} !( .*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
leads to who knows where
beta.1relax.ru/home/bitrix/ext_www/beta.1relax.ru/...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bismark1, 2018-09-24
@bismark1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.(jpg|gif|png|css|js|svg|ico|txt)$
RewriteCond %{REQUEST_URI} !(.*)/$
#RewriteRule ^( .*[^/])$ $1/ [L,R=301]
RewriteRule ^(.*[^/])$ https://%{SERVER_NAME}/$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