Some of our hosting plans include free SSL certs to encrypt data transmission between your client's browser and our server. Once the SSL cert is installed on your account, we need to instruct the server to use HTTPS when serving requests. To do this, we need to add some code to your sites .htaccess file (if you don't know how the edit the .htaccess file, please scroll to the end of this article for instructions).
To force all web traffic to use HTTPS instead of HTTP, insert the following lines of code in the .htaccess file in your website's root folder.
IMPORTANT: If you have existing code in your .htacess file, you'll need to add this where there are already rules with a similar starting prefix.
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.ie/$1 [R=301,L]
Don't forget to change the example.ie to the name of your actual domain name.
Once this code has been added, your site should load securely.
How to edit a .htaccess file:
- Edit the file on your computer and upload it to the server using FTP.
- Use “Edit” mode in FTP program that allows you to edit a file remotely.
- Use the File Manager in cPanel to edit the file (recommended method).
Editing .htaccess in cPanel File Manager
Note: Backup your .htaccess file in case something goes wrong.
- Login to cPanel
- Navigate to Files > File Manager > Document Root for the domain you wish to edit (usually /public_html/)
- Check "Show Hidden Files (dotfiles)"
- Click "Go"
- After a new tab or window opens, look for the .htaccess file.
- Right click on the .htaccess file and click on "Code Edit" on the menu.
- A dialogue box may pop up asking about encoding. Click "Edit" button to continue.
- Edit the file
- "Save Changes" when done.
- Test your website to make sure it loads correctly. If your website doesn't load correctly, restore to the previous version and try again.
Once you are done, click "Close" to close the window.