Redirect my WordPress website to HTTPS for Linux Hosting

Once you’ve installed your SSL certificate into your Linux Hosting account, you’ll need to make some changes to your .htaccess file so that it automatically redirects visitors to an HTTPS version of your WordPress site.

To do this:

Step 1 of 7

Log in to your WordPress account.

Step 2 of 7

Hover your cursor over Settings on the navigation panel and select General from the menu that appears.

Settings

Step 3 of 7

Under the ‘WordPress Address (URL)’ and ‘Site Address (URL)’ fields, update the links to state https instead of http.

Address

For instance, http://example.co.uk would become https://example.co.uk

Step 4 of 7

Once done, select Save Changes at the bottom of the page.

Step 5 of 7

From there, access your Hosting package via the 123 Reg control panel and open your .htaccess file in the /public_html/ folder through the cPanel file manager.

For details on how to do this, read our article ‘Redirect my cPanel website to HTTPS’.

Step 6 of 7

Copy the following code and place it at the start of your .htaccess file:

# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^coolexample\.com$ [OR]
RewriteCond %{SERVER_NAME} ^www\.coolexample\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security “max-age=300”
</IfModule>
# END GD-SSL

# 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>
# END WordPress

Step 7 of 7

Select Save Changes.