D
D
Diana2020-06-25 19:25:40
1C-Bitrix
Diana, 2020-06-25 19:25:40

How to redirect to a page with a slash?

https://murkel.ru/blog/katalogi-schleich-2020/ - base url for the blog.
I tried to remove the Bitrix info block settings (in two places) / in ELEMENT_CODE #, it doesn’t work without a slash at the end

https://murkel.ru/blog/katalogi-schleich-2020 - gives 404, it would be better if such the page gave a 301 redirect to the base one

in the product catalog, on the contrary
https://murkel.ru/catalog/eldador-drakony-schleich - the base url
and https://murkel.ru/catalog/eldador-drakony-schleich/ - 404, you need to gave a 301 redirect to the base url

Is it possible to implement this through .htaccess ?

Tried
#Redirect to page without /
RewriteCond %{REQUEST_URI} !(.*/manager.*)
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]

But in this case, the directory handles the redirect well, but the blog does not, respectively

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav Alexandrov, 2020-06-29
@alexyarik

#*со страниц без слеша на слеш*
    RewriteCond %{REQUEST_URI} !\?
    RewriteCond %{REQUEST_URI} !\&
    RewriteCond %{REQUEST_URI} !\=
    RewriteCond %{REQUEST_URI} !\.
    RewriteCond %{REQUEST_URI} !\/$
    RewriteRule ^(.*[^\/])$ /$1/ [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question