How do I re-direct non-https traffic to the https version of the website?

To re-direct a single site from http:// to https:// or https://www you would add the following code to an .htaccess file in the document root for the website (make sure to edit the entry for your specific domain):

Option 1 Redirects all http:// requests to the same website page, but with https://

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L]
</IfModule>

Option 2 Redirects all http:// requests to the same website page, but with https://www.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule .* https://www.example.com%{REQUEST_URI} [R=301,L]
</IfModule>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

VNC, + Java issue: "Application Blocked by Security Settings"

ISSUE: When attempting to access the java-based VNC applet under the VNC icon in Manage Servers...

How many IP addresses are provided with my VPS?

One IP address is provided with the establishment of your VPS account. Should you need to add...

How do I change boot order, and change the CD/DVD image?

1. Log into your client area at http://cp.dotblock.com     2. Click “Manage Servers” at the...

How to Check for a Firewall Block

Our cPanel servers come pre-installed with ConfigServer Security & Firewall or 'CSF', which...

Why are my emails being marked as spam?

If you are receiving bounceback messages or tags that your messages are being marked as spam and...