logo

Redirect http to https htaccess apache

logo

Are you wondering how to redirect to SSL via htaccess? Alot of users won’t type in the https or even http for that matter so if your site has an SSL certificate you will want to make sure your visitors get redirected to the secured site. This is very useful for websites with a secure layer. I will explain in this post exactly how to achieve this.

Presuming you have an Apache server, first off you will need to create a .htaccess file and put the following code in:-

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

What does the above code do? The first lines tells Apache that we want to use the mod_rewrite module, the second line checks whether HTTPS is off, the third line forces https.

Once you are happy simply upload the file to the root directory of your website.

I hope this helps some of you out there.

2 Responses to “Redirect http to https htaccess apache”

Leave a Reply

logo
logo
© daparky.com 2011