Setting .htaccess : redirect semua koneksi ke https

Untuk melakukan redirect semua koneksi yang masuk ke dalam sebuah web server melalui protokol http ke protokol https, maka caranya adalah dengan menambahkan script berikut ini ke file .htaccess di root directory web server tersebut.

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Ref:

http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html

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