How to redirect HTTP to HTTPS using htaccess

The below code when added to an .htaccess file will automatically redirect any traffic destined for http: to https:

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  • 180 Users Found This Useful
Was this answer helpful?

Related Articles

php_flag and php_value errors, and how to fix it.

Problem:You are seeing Internal Server Errors in your browser when you view your web site.You...

What is the path to public_html?

The full system path to public_html is:/home/username/public_html'username' is your cPanel username

What to do if your WordPress site is hacked

Why is my site hacked?Why is my site hacked? What should I do now?A web site is usually hacked...

Jika anda pengguna VPS, ini adalah cara mudah menukar DNS Shoppegram secara pukal

Sekiranya anda miliki VPS (atau server), dan ingin pointkan domain anda ke Shoppegram, sila ikut...

What are your DNS Nameserver details?

Please refer to your Welcome email that contains your username and password that you received...