Redirecting from http to https

The following snippet of code, added to your .htaccess file in your public_html folder redirects any access to a non https:// URL to a secure https:// URL preserving the rest of the URL after your domain name

This is particularly handy now that we provide free Let's Encrypt SSL certificates and your site may rank better in search engines who are increasingly favouring https:// over plain old http://.

# Redirect to https version of the url if not https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
RewriteRule (.*) https://www.%1%{REQUEST_URI} [L,R=301]
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Search Engine bots using up bandwidth

In order for a search engine to find your site, it uses something commonly called a 'bot'. A bot...

No access to website, email, ftp, ssh

If you can't access your website, email ftp, ssh or any other service then it may be a number of...

~username access

Previously we supported accessing your website by using /~username/ on the end of either the...

PCI DSS Compliance

PCI DSS Compliance is a set of regulations to ensure security of online transactions with credit...

Using Public Key Authentication with SSH

What is Public Key Authentication? Public key authentication uses a public and a private key...