Search

Using .htaccess to migrate to https

If you change your website from http to https, it’s usually a bigger problem due to the users that didn’t update their bookmarks or just ignore the new links you sent them in an email announcement again and again. But there is a pretty simple way thanks to mod-rewrite of the apache webserver. Just add those few lines to your .htaccess or vhost config:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]

This redirects any incoming http connection to the same site using https. If it’s done that way, people won’t even really notice that they are using a secured connection (if the certificate is valid)

This entry was posted in IT Related stuff and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

.