HTTP to HTTPS via mod_rewrite

March 8, 2008

I was looking for this information one day, and thought I would share what I found.

 

To redirect a website from http -> https I utilized mod_rewrite. And created a .htaccess file with the following contents.

 

$ cat .htaccess
Options FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)         https://your_server.com/$1

Comments

Got something to say?