Поддержка Проблемы и решения http страницы сайта отдают код 200 хотя настроен редирект на https

  • Добрый день.
    На данном сайте в .htaccess настроен редирект с http на https. По правильному, при запросе кода ответа сервера http://siap.by ответ должен быть

    HTTP/1.1 301 Moved Permanently
    HTTP/1.1 200 OK

    Но почему то при проверке сервисами получается ответ только
    HTTP/1.1 200 OK
    Что не так настроено?

    Страница, с которой нужна помощь: [войдите, чтобы увидеть ссылку]

Просмотр 7 ответов — с 1 по 7 (всего 7)
  • Модератор Yuri

    (@yube)

    ответ должен быть

    HTTP/1.1 301 Moved Permanently
    HTTP/1.1 200 OK

    Два кода в ответе быть не может. Либо — либо.

    Что не так настроено?

    Редирект.

    Если запросить код ответа сайта http://google.ru, то получим

    HTTP/1.1 301 Moved Permanently
    Location:     	http://www.google.ru/
    Content-Type:     	text/html; charset=UTF-8
    Date:     	Tue, 22 Oct 2019 06:32:09 GMT
    Expires:     	Thu, 21 Nov 2019 06:32:09 GMT
    Cache-Control:     	public, max-age=2592000
    Server:     	gws
    Content-Length:     	218
    X-XSS-Protection:     	0
    X-Frame-Options:     	SAMEORIGIN
    HTTP/1.1 200 OK
    Date:     	Tue, 22 Oct 2019 06:32:09 GMT
    Expires:     	-1
    Cache-Control:     	private, max-age=0
    Content-Type:     	text/html; charset=windows-1251
    P3P:     	CP="This is not a P3P policy! See g.co/p3phelp for more info."
    Server:     	gws
    X-XSS-Protection:     	0
    X-Frame-Options:     	SAMEORIGIN
    Set-Cookie:     	1P_JAR=2019-10-22-06; expires=Thu, 21-Nov-2019 06:32:09 GMT; path=/; domain=.google.ru; SameSite=none
    Set-Cookie:     	NID=189=FUYDEUIBDBExsqR1AFTaSNxRQgmrWXJ3R7W7SqIaTBsDAmOEHYhu95D54cCmR0ulK-A2nuco9PqBOvBiR2LjZNQA1WnwmNdiq1A-7WXMdcDZl0ZrlUkNO0WvK5Rmz_Z-XhqHsA_jNr3WAeTwE9uxVQLWOh7BIq6wSn3qvkbvD_s; expires=Wed, 22-Apr-2020 06:32:09 GMT; path=/; domain=.google.ru; HttpOnly
    Transfer-Encoding:     	chunked
    Accept-Ranges:     	none
    Vary:     	Accept-Encoding

    Этот сайт ведь также должен ответить, и кода в ответе все таки два получается.

    Модератор Yuri

    (@yube)

    Ничего подобного. От http://google.ru получаем

    HTTP/1.1 301 Moved Permanently
    Location: http://www.google.ru/
    Content-Type: text/html; charset=UTF-8
    Date: Tue, 22 Oct 2019 06:37:50 GMT
    Expires: Thu, 21 Nov 2019 06:37:50 GMT
    Cache-Control: public, max-age=2592000
    Server: gws
    Content-Length: 218
    X-XSS-Protection: 0
    X-Frame-Options: SAMEORIGIN
    

    А вторая часть с 200 — уже результат редиректа на http://www.google.ru/

    Скорость загрузки сайта оставляет желать лучшего

    https://www.host-tracker.com/ru/InstantCheck/1/a0cbb01f-9ff4-e911-828a-0003ff7328cc/

    Может быть есть смысл задуматься о смене хостинга.

    советую ответ сервера смотреть на бертале:
    https://bertal.ru/index.php?a7150319/siap.by/#h

    там четко показано:

    
    HTTP/1.1 200 OK
    Server: nginx/1.16.0
    Date: Tue, 22 Oct 2019 15:42:00 GMT
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Keep-Alive: timeout=60
    X-Powered-By: PHP/7.0.20
    Expires: Tue, 22 Oct 2019 15:42:04 GMT
    Vary: Accept-Encoding
    

    никакого редиректа нет.
    если вы настраивали редирект в .htaccess, а сервер работает полностью на nginx — то настраивать редирект надо в конфигах nginx, а не в .htaccess

    То есть надо уточнить на хостинге этот момент?

    До сих пор не смог решить проблему.
    .htaccess сайта выглядит так:

    # BEGIN WpFastestCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} =on
    RewriteCond %{HTTP_HOST} ^siap.by
    # Start WPFC Exclude
    # End WPFC Exclude
    # Start_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=dmitry|kirill|olga
    # End_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP_HOST} ^siap.by
    RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
    RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{REQUEST_URI} !(\/){2}$
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{QUERY_STRING} !.+
    RewriteCond %{HTTP:Cookie} !comment_author_
    RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
    RewriteCond /home/user2073945/www/siap.by/wp-content/cache/all/$1/index.html -f
    RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
    </IfModule>
    <FilesMatch "index\.(html|htm)$">
    AddDefaultCharset UTF-8
    <ifModule mod_headers.c>
    FileETag None
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
    </ifModule>
    </FilesMatch>
    # END WpFastestCache
    # BEGIN GzipWpFastestCache
    <IfModule mod_deflate.c>
    AddType x-font/woff .woff
    AddType x-font/ttf .ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE x-font/ttf
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
    </IfModule>
    # END GzipWpFastestCache
    # BEGIN LBCWpFastestCache
    <FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$">
    <IfModule mod_expires.c>
    AddType application/font-woff2 .woff2
    AddType application/x-font-opentype .otf
    ExpiresActive On
    ExpiresDefault A0
    ExpiresByType video/webm A10368000
    ExpiresByType video/ogg A10368000
    ExpiresByType video/mp4 A10368000
    ExpiresByType image/webp A10368000
    ExpiresByType image/gif A10368000
    ExpiresByType image/png A10368000
    ExpiresByType image/jpg A10368000
    ExpiresByType image/jpeg A10368000
    ExpiresByType image/ico A10368000
    ExpiresByType image/svg+xml A10368000
    ExpiresByType text/css A10368000
    ExpiresByType text/javascript A10368000
    ExpiresByType application/javascript A10368000
    ExpiresByType application/x-javascript A10368000
    ExpiresByType application/font-woff2 A10368000
    ExpiresByType application/x-font-opentype A10368000
    ExpiresByType application/x-font-truetype A10368000
    </IfModule>
    <IfModule mod_headers.c>
    Header set Expires "max-age=A10368000, public"
    Header unset ETag
    Header set Connection keep-alive
    FileETag None
    </IfModule>
    </FilesMatch>
    # END LBCWpFastestCache
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    # Настройка кеширования
    
    <ifModule mod_deflate.c>
    	AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-font-ttf application/xml image/webp image/svg+xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
    </ifModule>
    
    <IfModule mod_gzip.c>
    	mod_gzip_on         Yes
    	mod_gzip_dechunk    Yes
    	mod_gzip_item_include file		\.(html?|txt|css|js|php|pl|woff2|ttf)$
    	mod_gzip_item_include mime		^text\.*
    	mod_gzip_item_include mime		^application/x-javascript.*
    	mod_gzip_item_exclude mime		^image\.*
    	mod_gzip_item_exclude rspheader	^Content-Encoding:.*gzip.*
    </IfModule>
    
    <ifModule mod_headers.c>
    	#кэшировать css, javascript и текстовые файлы на месяц
    	<FilesMatch "\.(js|css|txt|woff2|ttf|woff)$">
    		Header set Cache-Control "max-age=25920000"
    	</FilesMatch>
    	#кэшировать флэш и изображения на месяц
    	<FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png|svg|webp)$">
    		Header set Cache-Control "max-age=25920000"
    	</FilesMatch>
    	#отключить кэширование
    	<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
    		Header unset Cache-Control
    	</FilesMatch>
    </IfModule>
    
    <ifModule mod_expires.c>
    	ExpiresActive On
    	#по умолчанию кеш в 5 секунд
    	ExpiresDefault "access plus 5 seconds"
    	#кэшировать флэш и изображения на месяц
    	ExpiresByType image/x-icon "access plus 25920000 seconds"
    	ExpiresByType image/jpeg "access plus 25920000 seconds"
    	ExpiresByType image/png "access plus 25920000 seconds"
    	ExpiresByType image/gif "access plus 25920000 seconds"
    	ExpiresByType image/svg+xml "access plus 25920000 seconds"
    	ExpiresByType image/webp "access plus 25920000 seconds"
    	ExpiresByType application/x-font-ttf "access plus 25920000 seconds"
    	ExpiresByType application/x-shockwave-flash "access plus 25920000 seconds"
    	#кэшировать css, javascript и текстовые файлы на одну неделю
    	ExpiresByType text/css "access plus 6048000 seconds"
    	ExpiresByType text/javascript "access plus 6048000 seconds"
    	ExpiresByType application/javascript "access plus 6048000 seconds"
    	ExpiresByType application/x-javascript "access plus 6048000 seconds"
    	#кэшировать xml файлы на десять минут
    	ExpiresByType application/xhtml+xml "access plus 6000 seconds"
    </ifModule>
    
    

    Пробовал всевозможные варианты вставок из темы https://ru.wordpress.org/support/topic/%d0%bf%d1%80%d0%be%d0%b1%d0%bb%d0%b5%d0%bc%d0%b0-%d1%81-%d1%80%d0%b5%d0%b4%d0%b8%d1%80%d0%b5%d0%ba%d1%82%d0%be%d0%bc-%d0%bd%d0%b0-https/ но безуспешно. Сайт всегда либо вообще переставал работать, либо все время переадресовывался на главную.

Просмотр 7 ответов — с 1 по 7 (всего 7)
  • Тема «http страницы сайта отдают код 200 хотя настроен редирект на https» закрыта для новых ответов.