How do I use a .htaccess rewrite to force HTTPS on a domain?

You are able to force HTTPS on a domain with an SSL, using the following 3 lines in a .htaccess file, in the root directory (or the directory you wish to force SSL on)

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://{domain name}/$1 [R,L]
Where {domain name} is for example http://www.mysau.com.au

Advertisements
Tagged , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: