How to redirect from http to https, and why is this needed?

More and more sites are looking to upgrade to the new HTTPS protocol. This new mod is also picked up by search engines, which rank higher sites with this security protocol. Hostings offer services in the form of providing free certificates; corresponding plugins for content management systems come out. Therefore, each webmaster can easily switch to a new protocol and implement a redirect from http to https to Bitrix, WordPress and other CMS. But what is it for?

redirect from http to https

What gives the transition from HTTP to HTTPS?

The introduction of a new security protocol for a site can occur for three reasons:

  1. Confidentiality The Internet is an open environment, and https here protects communications between the parties. In the absence of HTTPS, the owner of the access point will have access to private data: credit cards (when making a purchase in an online store, for example).
  2. Integrity The https protocol ensures that information is delivered to the recipient intact. For example, the owner of Wi-Fi will be able to insert β€œleft” ads on the site, change the appearance of the site and compress images to save traffic. But if the site has HTTPS, then this ensures that the site will not be changed.
  3. Authenticity . The certificate ensures that the site you visit is truly authentic.

That is, the https protocol ensures that all information will be transmitted in its entirety and precisely to the address. No one will be able to change the information during its transmission. This is especially true for various online stores and payment services.

https protocol

Certification also has a positive impact on website promotion in search engines. Therefore, many webmasters receive security certificates for their sites. But after receiving, they encounter a problem - tuning. It is not enough just to get a certificate, you need to correctly redirect all traffic to the new domain and "tell" the search engines about it. How to do it?

Training

Before creating a redirect from http to https, you need to prepare a site. The very first step is to make internal links relative. That is, you must remove the "http: //" characters at the beginning of the link. You can also add the letter "s" to the specified characters so that all your articles link to a version of the site with a security protocol, but this must be done after the site’s final transition.

htaccess redirect from https to http

Make it easy. Now there are many programs for different content management systems that in a couple of seconds will make all links on the site relative. For example, for the popular Wodpress system there is an HTTP / HTTPS Remover plugin.

Check

After installing the certificate and setting up external links, it is advisable to check whether the certificate has "become" correctly. This can be done using the special service ssllabs.com. There you need to enter the domain name of the site, click on the Sabmit button, after which the system will show an assessment of the connection settings and give tips on solving possible problems. If the Overall Rating parameter has a rating of "A", then everything is fine and your security certificate is good.

Redirect setup from http to https

Search engines perceive sites with an HTTPS certificate and without it as two completely different sites. Therefore, setting up a redirect from http to https is required. This procedure is equivalent to a domain change. In this case, forwarding must be set up directly and it is important that it does not contain intermediate documents. Otherwise, chains of redirects may form, which can confuse search engines. Naturally, this will negatively affect the perception of the site and will not bring any benefit.

redirect from http to https in bitrix

The easiest option is to edit the htaccess file . A redirect from HTTP to HTTPS using this file is done if the site is hosted on an Apache server. It is necessary to register the following lines in the file:

[...]

Rewriteengine on

RewriteCond% {HTTPS} off

RewriteRule (. *) Https: //% {HTTP_HOST}% {REQUEST_URI}

[...]

You can simply copy and paste the htaccess into your file. Recall that it is located at the root of your site and is always present on sites running Apache.

After writing this code, check if the redirect from http to https really worked. To do this, simply go to any page of the site and see if you are redirected to a domain with an https certificate. If so, go to the other pages.

Now, when the search engine robot gets to your site, it will be automatically redirected to the https version. It will take him time to understand what's what and to bring this data into his algorithm. Typically, the perception of the transition and redirect from http to https for the Yandex search engine takes about a month, although Google takes a week or two.

Remember that switching to https is not always successful. Sites of some webmasters after this procedure fall strongly in positions in search engines, drop out of the index, and then again get into it very soon. Sometimes you have to sacrifice a large share of traffic, and many webmasters are extremely unhappy with the result of the transition. TIC is also reset to zero, and although it is later restored, at the time of its zeroing, the site looks very bad in the eyes of advertisers.

However, most often a redirect goes almost painlessly and quickly. Yandex within a month "sticks together" the site and its mirror, and as a result, all traffic returns back, but to the new domain with the https prefix.

Conclusion

Sooner or later, the transition to a new security protocol will have to. Soon, this will become one of the key requirements of search engines that simply will not rank high sites with the http protocol. So why not do it before your competitors do? Yes, it will be hard at first, and you are likely to lose some of the traffic, but you will definitely win in the long run. At least that’s what the search engines themselves say. There is no reason not to believe them. In general, the transition to https is the improvement of your site in terms of security.

Source: https://habr.com/ru/post/C3312/


All Articles