Redirecting traffic from http to https using htaccess
- KnowledgeBase /
- Certificats SSL /
- Redirecting traffic from http to https using htaccess
Once you have installed an SSL certificate, the next step is generally to set up the redirection from your http links to the https or secure links.
The .htaccess file is generally present in your public_html folder and can be edited or created by using the FILE MANAGER program in cPanel. Please ensure you have enabled the option to view hidden files in File Manager, which you can set by clicking on the gear icon icon from the top right hand corner of File Manager.
Once you have done the above, you should be able to view the .htaccess file and edit it. However, if it is not present, you may need create a new file, with the name '.htaccess'. Please note the use of the full stop preceeding the 'h'. Once you have created the file, simply edit and add the below rule.
# Let's force HTTPS from here on
RewriteEngine On RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI}
NOTE: The above example will redirect to the WWW version of your site. If you dont wish to redirect to the WWW, please replaced the last line above, with:
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Once you have done this, all pages with a http in the URL, will redirect to https.
NOTE : this is for semi advanced users only. Incorrect use or changes to the .htaccess file can prevent your site from loading.
Open ticket
Submit a support ticket