Answer the question
In order to leave comments, you need to log in
What am I doing wrong with the redirect?
We migrated our site from WordPress to Bitrix. We are trying to redirect all external links, redirect to new paths, adding (/ / - so that the protocol is not eaten)
Redirect 301 /oldpath1/oldpath2/oldpath3/ http:/ /site.ru/newpath1/newpath2/
But these rules do not work correctly. For example, in the rules below
Redirect 301 /menu/ http:/ /site.ru/company/ ##
Redirect 301 /menu/about http:/ /site.ru/company/
Redirect 301 /menu/about/ http:/ /site .ru/company/
line "Redirect 301 /menu/about http:/ /site.ru/company/" will redirect the user to http:/ /site.ru/company/about, not http:/ /site.ru/ company/
The 3rd line will work in the same way, but only "/" will be added at the end.
If, for example, I specify the rules like this: RewriteRule ^menu/about$ /company/? [L,R=301], there is no redirect at all and a 404 error is returned.
What am I doing wrong? Is this somehow related to the rules that are described in the .htaccess file at the very beginning (that is, those that are already there when installing bitrix)?
Also, in addition to these lines, .htaccess contains what "came" with bitrix itself (I added my own rules to the end of the file):
Options -Indexes
ErrorDocument 404 /404.php
<IfModule mod_php5.c>
php_flag session.use_trans_sid off
#php_value display_errors 1
#php_value mbstring.internal_encoding UTF-8
php_flag register_globals off
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
<IfModule mod_expires.c>
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"
</IfModule>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question