Do you have a active SSL certificate and you're wondering why your website is still marked as insecure? this happens because most popular browsers default to request websites over HTTP connection (rather than a secure HTTPS connection). To ensure your website is served over a secure connection, you must implement a force redirect so all traffic requesting your website over HTTP is redirected to HTTPS.
This guide will teach you how to implement a force HTTPS redirect so all web traffic visits your site over a secure connection.
To complete this guide, you need your SSH login details on hand and your website must have an active SSL certificate.
- Open your terminal window and ssh onto your hosting server:
ssh username@yourserver.serversaurus.com.au
When prompted, enter your password - Change into your public_html directory (or alternative document root location):
cd public_html
- Open the .htaccess file:
vi .htaccess
- Add the following text to the beginning of your .htaccess file by typing i and then paste the text into the window, once completed press esc:
- :
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] - To exit vi, enter :wq to save.
To confirm your changes are successful, open your browser and enter your domain name, your site should be redirecting to HTTPS!
Comments
0 comments
Please sign in to leave a comment.