WordPress Redirect to https

Your WordPress website was running as a traditional unsecured site.

Now to meet the search engine guidelines you have added a certificate and encrypted the website.

But the old unencrypted website address is still accessible.

This isn’t good for SEO with effectively two websites with the same content.

How to redirect the unencrypted traffic to the encrypted website address.

We’ll add the redirect to the .htaccess file found in the root of the website.

Shown below is the default entry in the .htacces file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

The additional redirect rule to be added is:

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

And here it is the updated version, with the additional redirect rule added.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

The content of the .htaccess file may be amended via the hosting control panel or via FTP.

You may wish to take this amendment as a prompt to take a backup of your website files.