Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Problem with Bitrix redirect substitutes port 80. How to fix?
The site has moved to https, but when you try to access from http, it redirects to https and adds :80 at the end and, accordingly, does not open:
[[email protected] site_avaliable]# curl -I www.site.ru HTTP/1.1 301 Moved Permanently
Server: nginx/ 1.16.1
Date: Wed, 11 Nov 2020 12:24:54 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: https://www.site.ru:80/
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
.htaccess
Options chunk +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI} !/bitrix/admin/1cv7_exchange.php
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI } [L,R=301]
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}]
What could be the problem where to dig?
Answer the question
In order to leave comments, you need to log in
Working version, taking into account 1C, https, without www
Options -Indexes
ErrorDocument 404 /404.php
php_flag display_errors on
php_value error_reporting 6143
php_value memory_limit 256M
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ https://mysite.ru/ [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ https://mysite.ru/ [R=301,L]
RewriteCond %{REQUEST_URI} !^/bitrix/admin/1cv7_exchange\.php$
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://mysite.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} //
# Проверяем, повторяется ли слеш (//) более двух раз.
RewriteRule .* /$0 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [R=301,L]
<IfModule mod_php7.c>
php_flag session.use_trans_sid of
php_value display_errors 1
#php_value mbstring.internal_encoding UTF-8
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} /(.*)index.php.*$
RewriteCond %{THE_REQUEST} !bitrix/admin/
RewriteRule .* /%1 [R=301,L]
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>
In your case, a simple way without configuring nginx and apache may work.
You need to add the following lines in the dbconn.php file:
if (($pos = strpos($_SERVER['HTTP_HOST'], ':')) !== false)
{
$HTTP_HOST = $_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'],0,$pos);
}
this is due to the configuration of your machine and, as a rule, in 99% it is in the nginx + apache bundle where you have port 80 with protocol substitution on the back, in fact this is what happens.
The problem is that the port is already in the reffrey header.
1. the option to put a back on https
in this case, you will not need to substitute the port and everything will be fine, but for some reason they don’t do it, moreover, in all mana they prefer the method with a crutch and problems rather than normally redirecting
http-http
https-https
no need to twist crutches .
2. there are about 30 types of redirects to https, you need to choose the one that suits you. (don't forget to disable the redirect cache in your browser) otherwise you just won't know that everything works.
3. https://klondike-studio.ru/standards/standartnyy-h... take this file as a basis. also, if you have a problem with the exchange, then it is solved here, the reason here is that there is https in GET and it is redirected.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question