Force HTTPS using a redirect Print

  • 0

If you have setup an SSL certificate and you want all incoming HTTP requests to use the SSL you need to force the browser to use HTTPS requests. To do this you need to create a .htaccess file and place this in the root of your web folder (HTTPDOCS)
If you already have a .htacess file you can just edit it with a text editor (we use notepad++) and enter the following code at the top. (The dot before htaccess is required in the name)

Make sure you enter the code cleanly with no additional carachters or spaces as this can break the functionality of the .htacess. Save the file , upload it to your web folder and then test your site again to see if its loading under HTTPS

####### Redirect to https ##################################
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
######################################################

Remember to change yourdomain.com to the domain name of your website.


Was this answer helpful?

« Back