M
M
Michael_Mel2021-01-14 15:00:53
htaccess
Michael_Mel, 2021-01-14 15:00:53

How to properly issue a 301 redirect and remove duplicate pages?

Colleagues, help, there are so many things on the Internet and I can’t find the right working solution!

it is necessary to get rid of duplicate pages that give the services

the rule of getting rid of slashes:

RewriteCond %{THE_REQUEST} ([^\s]*?)\/{2,}(\?[^\s]*?)?
RewriteRule (.*) %1 [R=301,L]


however, when prescribing such a rule, it redirects to 404.rnr, and the full address with folders of the form site.ru/var/www/u00000007/public_html/site.ru appears in the URL,
plus it

gives the availability of addresses
site.ru/index.php
site.ru ?

Please help me to solve this issue!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-01-14
@dodo512

RewriteCond %{THE_REQUEST} ^[^?]+//
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