Blog

How to redirect non ssl (http links) traffic to SSL (https links)

Tags: httpsnon-sslsecure URlssl

Published on: December 14, 2009 by George K.

How to redirect non ssl (http links) traffic to SSL (https links)

Scenario:

Our server tech support team often gets tickets like how to make http:// or http://www. redirect to https:// or https://www. Often the answer is simple, but for the newbies and yours use, I am putting it here.

First requirement is to have an SSL certificate installed. Add the following lines in a .htaccess file:

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

I assume when you directly access https://www.domainname.com , the site loads fine.

Category : Apache, cPanel, General, Howtos, Linux, Security, Training, Troubleshooting

George K.

George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend