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 ^(.*)$ https://www.mydomain.com/$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 "https://mydomain.com". 

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 "http://mydomain.com" - 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.
  • 15 Users Found This Useful
Was this answer helpful?

Related Articles

Do you offer private WHOIS? How do I get it?

Private WHOIS can be enabled for free upon request after your domain has been registered...

How do I transfer a domain to Arch Hosting?

A domain transfer to Arch Hosting can be simple, easy, and be started and finished within 48...

What are the nameservers?

Where do I find the nameservers?You must update your domain's nameservers in order for it to work...

How do I get started using my Web Hosting?

If you've never worked with cPanel before, it can certainly be intimidating at first sight. Don't...

Do you support OpCache?

We currently do not support OpCache, and can not enable this on your web hosting account.However,...