Redirect from HTTP to HTTPS SS Secure Site

To force your website visitors to access your website using httpS:\\sitename.com  instead of http:\\sitename.com , then follow the below instructions:

 

  1. Edit or create a file known as .htaccess   in the root of your web folder (typically is  /public_html/)

    2. In the .htaccess , add the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


 

  • https, htaccess, ssl, forward to https
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to Password Protect a Directory

This tutorial will teach how to password protect a directory. Password protecting a directory...

How To Use The IP Deny Manager

This tutorial will teach you how to use the IP Deny Manager to block access to your web site from...

Using Hotlink Protection

Hotlink Protection prevents other web sites from directly linking to certain files (typically...

How to secure web application and folders using .htaccess

Open source web applications alike WordPress, Moodle, DruPal and others are commonly used to...

How to secure WordPress and clean up a hack

Here are some tips on securing your Word Press install after a hacking incident:-...