M
M
mirage_lav2020-09-28 12:24:15
1C-Bitrix
mirage_lav, 2020-09-28 12:24:15

301 redirect in Bitrix and self-crawling /?

At the site on Bitrix, they decided to put cataloging in order, and in order not to jitter and not run around with unnecessary redirects, when shuffling through sections, it was decided to average all products on a "virtual" section, i.e.

a link for any products turned out to be of the form site/catalog/section for everyone/product name, instead of site/catalog
/ section1/subsection1/product name / https://site/catalog/section for all/

but 2 problems got out, 1 it starts to divert the section page to "section for all", but it seems to have been cured by the exact
Redirect 301 /catalog/old section/. https://website/catalog/section for everyone/

Although I can't be sure that this is correct.

And then
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.*/[^/.]+)($|\? )

which logically puts a slash at the end and the newly made address says that it's not him and still throws at 404
tried to replace the last line above with
RewriteRule ^(.+)/$ $1 [R=301,L]
and it falls into such a cycle that The page won't load at all.

put in the new address / after .html ... probably would not be desirable. And where does he get it xs, so everything would fall smoothly.

while writing, it seems that I found a working version // correction, it still throws it into the loop :( and for some reason in the Yandex browser under the admin it redirects without a slash, but in the mozilla the slash remains the guest
RewriteRule ^catalog/section 1/section2/(.+ )$ /catalog/section for all products/$1 [L,R=301]
RewriteCond %{REQUEST_URI} \..+$
# If the file contains a dot
RewriteRule ^(.+)/$ /$1 [R=301,L ]
# Exclude slashes

I'm afraid to scare you, because there will be 22 lines of redirects, I'll check it tonight.So

this came out ... either a question or an answer. Maybe it will come in handy for someone, but I will be grateful for ideas

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2020-09-28
@shambler81

1. the "main section" has long been implemented in Bitrix
2. Here I wrote about the standard settings for Bitrix, I think it will be useful.
3. it is logical to put a slash, but not so, and sometimes it needs to be deleted, for example, if this is a physical file, I already wrote about this.
4. 22 redirect lines is nothing, just like 6000 lines, do as many as you need.
problems start from 50K lines.
5. the list of urls was all

M
mirage_lav, 2020-09-28
@mirage_lav

The main section is yes, I know I use it, but sometimes there is a need to shuffle from section to section noticeably (there was a bunch of vinyl and mineral tiles, and now they need to be divided into 2 sections, because there are already a lot of them, and it’s divided, and not to duplicate)
Yes, thank you very much, I took from your works ... yes, apparently, or not all or not. Now I'll try on another site, the main one is working, it's only if you torment it at night.
Oh thanks. I'll be in the know - it's good that it's not so scary.
This is me preparing the lines for a simple redirect


Redirect 301 /catalog/kovrolin/. https://website/catalog/pf/
Redirect 301 /catalog/kovrolin/vystavochnyy_kovrolin/. https://site.ru/catalog/pf/
Redirect 301 /catalog/vinilovaya_plitka/. https://site.ru/catalog/pf/
Redirect 301 /catalog/kovrovaya_plitka/. https://site.ru/catalog/pf/
Redirect 301 /catalog/parket/. https://site.ru/catalog/pf/
Redirect 301 /catalog/stenovoy_dekor/. https://site.ru/catalog/pf/
Redirect 301 /catalog/probka/. https://site.ru/catalog/pf/
Redirect 301 /catalog/laminat/. https://site.ru/catalog/pf/
Redirect 301 /catalog/plintus_i_dekor/. https://site.ru/catalog/pf/
Redirect 301 /catalog/plintus_i_dekor/moduleo/. https://site.ru/catalog/pf/
Redirect 301 /catalog/plintus_i_dekor/nmc/. https://site.ru/catalog/pf/
Redirect 301 /catalog/plintus_i_dekor/orac_decor/. https://site.ru/catalog/pf/
Redirect 301 /catalog/kley_i_khimiya/. https://site.ru/catalog/pf/
Redirect 301 /catalog/podlozhka/. https://site.ru/catalog/pf/
Redirect 301 /catalog/porozhek/. https://site.ru/catalog/pf/
Redirect 301 /catalog/aksessuary/. https://site.ru/catalog/pf/
Redirect 301 /catalog/arkhiv/. https://site.ru/catalog/pf/
Redirect 301 /catalog/arkhiv/ellade/. https://site.ru/catalog/pf/
Redirect 301 /catalog/iskusstvennaya_trava/. https://site.ru/catalog/pf/
Redirect 301 /catalog/plintus_i_dekor/. https://site.ru/catalog/pf/
All lead to the same place

And this is the whole base .htacces
display_startup_errors off
php_flag php_flag display_errors off
php_flag html_errors off
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /home/l/lavstotd/stokpol.rf/public_html/PHP_errors.log
php_value error_reporting 2047
php_value log_errors_max_len 0
php_value max_input_vars 10000
Order allow,deny
Deny from all
Satisfy All
Options -Indexes
ErrorDocument 404 /info/404
php_flag session.use_trans_sid off
#php_value display_errors 1
#php_value mbstring.internal_encoding UTF-8
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.*/ [^/.]+)($|\?)
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER :%{HTTP:Authorization}]
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]
DirectoryIndex index .php index.html
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
ExpiresByType image/png "access plus 3 day"
ExpiresByType text/css "access plus 3 day"
ExpiresByType application/javascript "access plus 3 day"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question