Wordpress

WordPress : Force HTTP to HTTPS

Google announced a plan to improve overall web security by encouraging website owners to make the switch from HTTP to HTTPS. As part of this plan, their popular Chrome web browser would mark all websites without a SSL certificate as “Not Secure” starting July 2018.

What is HTTPS ?

Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP). It is used for secure communication over a computer network, and is widely used on the Internet.[1][2] In HTTPS, the communication protocol is encrypted using Transport Layer Security (TLS) or, formerly, Secure Sockets Layer (SSL). The protocol is therefore also referred to as HTTP over TLS,[3] or HTTP over SSL. (wikipedia)

So you can say HTTPS is an encryption method that secures the connection between users browser and your server. This makes it harder for hackers to spy on the connection.

How to Force your web HTTP to HTTPS ?

  1. Go to File Manager in your hosting panel like cpanel or using FTP and open .htaccess inside the public_html folder. If you can’t find it, make sure to create new file or unhide it.

  2. Adding code bellow to you .htaccess file
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>
  3. Save the changes.

For WordPress you need another step to make it perfect

  1. login to your wordpress dashboard

  2. go to General settings
    Wordpress General Setting

  3. change http to http on fields WordPress Address (URL) & Site Address (URL)

If you want to force SSL and HTTPS on your WordPress admin area or login pages, then you need to configure SSL in the wp-config.php file.

Simply add the following code above the /* That’s all, stop editing! Happy blogging. */  line in your wp-config.php file:

define('FORCE_SSL_ADMIN', true);

This line allows WordPress to force SSL / HTTPs in WordPress admin area. It also works on WordPress multisite networks.

Hope it can help..

Leave a Comment

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