How do I force SSL on my website?

If you have a valid SSL certificate, you may want to force your website to always run with SSL (https:// instead of http://)

There are a few ways you can do this, but the easiest way is by editing your .htaccess file and using the mod_rewrite Apache module. 

Perform the following steps:
- Log in to your cPanel
- Open the File Manager, and enable hidden files (click the "Settings" button in the uppermost top right corner in your File Manager)
- Visit the folder that contains your website, usually this will be /public_html. If you've installed your website into a specific folder, like /wp, then visit that folder. For example, /public_html/wp/
- Open the .htaccess file for editing. If this file does not exist, create it and open it for editing. Make sure it is spelled exactly: ".htaccess" (no quotations)

Then, add the following code to your .htaccess file. 

Note: If there's already some other code in your .htaccess file, do not delete it. Add the code shown below at the very top of the .htaccess file, and leave some blank lines between this code and the existing code.
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$$1 [R,L]
Note: You will want to change "www.mydomain" to your actual website domain - don't let it literally say "mydomain". You do not need to include the "www" part, that's only if you want your website to have the "www." prefix. For example, you could write "". 

That's it! Keep in mind, this only enforces 'https://' for all your site pages and does not grant you a valid SSL certificate. You need to have a signed SSL certificate configured correctly, or your website will show a security error. Arch Hosting offers free SSL certificates, and information on how to obtain one can be found here.

One last thing - if you are using a content-management system (like Wordpress), it is highly recommended that you make one more additional change. You will want to log in to your Wordpress (or other CMS) admin area, and visit your website settings and change your website's URL to include the "https://". For example, on default non-SSL configurations it will say "" - you will want to update that and add the "s" after "http". This will ensure that all files (images, style sheets, etc.) are also loaded over SSL.
  • 12 Users Found This Useful
Was this answer helpful?

Related Articles

"Cannnot modify header information" PHP Error

You may encounter the following PHP error: Warning: Cannot modify header information - headers...

How to show hidden files in cPanel's File Manager

In your cPanel account, search for the 'File Manager' button under the 'Files' category. Once you...

Do you offer SSH for Web Hosting?

Yes, Arch Hosting offers SSH access for web hosting accounts. It is disabled by default and can...

Can I upgrade my plan in the future?

Most of the time, we can upgrade your plan upon request. If you want to start out with a smaller...

How do I add extra domains to my hosting plan?

You may add additional domains by visiting the Addon Domain section of your hosting cPanel.Please...