Redirect your HTTP traffic to HTTPS

HTTPS

HTTPSHTTPS is a secured protocol of communication on the web. More and more sites are using the HTTPS instead of the standard HTTP (not secured). The main reasons for this change are:

  1. Google, announce earlier this year that site using HTTPS will have an advantage over sites using HTTP to enhance the SEO of your site,
  2. You can get better performance by using the protocol HTTP/2 which require the use of HTTPS,
  3. HTTPS is more secure as all transmitted information are encrypted,
  4. HTTPS give more trust to the visitor of your site

 

How to redirect HTTP to HTTPS

It is recommended to opt for doing the configuration on the server rather than using plugin on a WordPress installation. The plugin can be a quick fix, temporary solution, but open the door to other possible issues such as incompatibility with other plugins, more plugin to be updated, more memory used on the WordPress, …

Apache Server

Like for enabling the GZIP compression we need to edit the .htaccess file in the root directory of the site and add the following lines:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

or

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

You are required to only use one of the two above.

NGINX Server

For this type of server you need to modify your nginx.con and add the following lines of code:

server {
listen 80;
server_name domain.com www.domain.com;
return 301 https://domain.com$request_uri;

 

WordPress Plugin

If you insist in using a plugin, you can use the Really Simple SSL plugin for WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × 4 =