M
M
Maxim2017-02-28 00:20:51
htaccess
Maxim, 2017-02-28 00:20:51

How to remove cyclicity when redirecting from one page of the site to another page of the same site?

Good afternoon!
The site has 2 pages:
1st - site.ru/catalog 2nd - site.ru/catalog/pererabotka-myasa
Both pages are completely the same, only on the first one the vertical menu is collapsed, and on the second in the vertical menu the item, - processing-meat, disclosed.
I want to prohibit the 1st page from indexing and make a redirect from it to the 2nd. Started with a redirect.
Googling, I came up with this code:

Redirect 301 /catalog http://site.ru/catalog/pererabotka-myasa

and pasted it into the already existing code (see below), after RewriteEngine On
RewriteEngine On

[u]сюда вставил код указанный выше[/u]

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 
RewriteRule ^index\.php$ http://site.ru/ [R=301,L]

RedirectMatch 301 ^/index.php/ http://site.ru/

As a result, when I go to the catalog - to the 1st page, nothing has changed for me, there is no redirect, and when I go to the 2nd page
site.ru/catalog/pererabotka-myasa , which, in theory, should be redirected, it generally became give a Google error, too many redirects from your site,
the following url in the search bar: site.ru/catalog/pererabotka-myasapererabotka-myasa... and so on ad infinitum.
1. So far I have removed the code, now my page has remained looped and gives out a 404 error, I know that I need to clear the cookies,
but how did other people visit the site? they obviously won't guess to clear the cookies
.
3. In some articles on redirects, I read that it is better to avoid redirects of the internal pages of the site,
since search bots have a bad attitude to this and, accordingly, have a bad effect on site promotion, is that true?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-02-28
@Maksiklass

RewriteCond %{REQUEST_URI} !/catalog/pererabotka-myasa$
RewriteRule ^catalog$ /catalog/pererabotka-myasa [L,R=301]

! - negation of
RewriteCond - if

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question