Once you have installed an SSL certificate on your Linux Hosting account, you will need to update the .htaccess file to ensure that visitors are automatically redirected to the HTTPS version of your WordPress site.
Note: These guidelines are not relevant for Managed WordPress accounts that have an SSL certificate, as the certificate itself automatically handles the HTTPS redirection once it has been installed.
- Log into your WordPress Dashboard.
- Hover over Settings on the left navigation panel, then click General.
- Locate the following fields on the new page:
- WordPress Address (URL)
- Site Address (URL)
- In each field, update your URLs to include https instead of http.
- For example, http://myonlinefurniture.com would become https://myonlinefurniture.com.
- Scroll down to the bottom of the page and click Save Changes.
- Open your current
.htaccess
file in the/public_html/
folder with the cPanel file manager for editing. If you don’t already have a.htaccess
file, you’ll need to create one. - Insert the following code at the top 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
8. Click Save Changes at the top-right corner of the screen.
In this manner, HTTP requests for a WordPress site can be rerouted to the HTTPS protocol.
Thanks for visiting. For queries and suggestions, emails are welcome at learnweb@hostingcolumn.com.
Subscribe to Hosting Column for the latest updates and posts.