Force SSL on a WordPress Site

Force SSL on a WordPress Site

What is SSL?

An SSL (Secure Sockets Layer) certificate is a digital certificate that authenticates the identity of a website and encrypts information sent to the server using SSL technology. Encryption is the process of scrambling data into an undecipherable format that can only be returned to a readable format with the proper decryption key. In other words, provide security to your Website or eCommerce site.

What is HTTPS?

The ‘S’ at the end of HTTPS stands for ‘Secure’. Hyper Text Transfer Protocol Secure (HTTPS) is the secure version of HTTP, the protocol over which data is sent between your browser and the website that you are connected to. It means all communications between your browser and the website are encrypted. HTTPS is recommended to protect highly confidential online transactions like online banking and online shopping order forms.

Why do you need HTTPS and SSL?

If you are collecting sensitive information like payment, billing or shipping on your Website or eCommerce site. Definitely, you need it because this requires a secure connection using SSL. The majority of Payment Gateways request this kind of security to avoid all kind of fraud situations in your platform.

It is also necessary since improves your site’s SEO after Google announced that all ranking results were going to be affected if your site is not secure.

Here at Tresup, always recommend to our clients use HTTPS and SSL.

How to Force SSL on your WordPress site?

Update your wp-config.php file with the following lines of code.

/**
* Overwrite WordPress Variables
*/

// Set Site URLs
define( 'WP_HOME', 'https://www.yourdomain.com' );
define( 'WP_SITEURL', 'https://www.yourdomain.com' );

// SSL settings
define( 'FORCE_SSL_ADMIN', true );

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
   $_SERVER['HTTPS']='on';
}

Change “www.yourdomain.com” by your desired domain.

Another important note of this special way to set the site URLs is that you control your domain info directly in your wp-config, forcing to your website to look for this domain and never touch the database.

Leave a Reply

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