How to translate a website to https

Before switching to HTTPS, it is necessary to translate all the media content of the site, pictures, videos, scripts, styles to relative addresses or to https:// addresses, the same applies to external scripts (all external counters, advertising codes, etc.).

After the SSL certificate is installed, the site needs to be configured so that search engines perceive the https site as the main one when searching. You must specify the Host directive in the file robots.txt For example, Host: https://www.hostetski.ru and set 301 redirect from http to https. To do this, you need to add the code in the htaccess file.

Variants:

1.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

2.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

3.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

After setting up the site, it is advisable to inform the search engines that you have an SSL certificate installed and configured. This is done in the panel for webmasters from both Google and Yandex. This should be done so as not to lose some of the search traffic of your site.