How to force HTTPS using .htaccess

In order to force all HTTP requests to your site to resolve using the secure HTTP (HTTPS) protocol, simply add the following in the .htaccess file which can be located in your root (public_html) directory:

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

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

phpSuExec or suPHP

PHPsuExec (pronounced sue-eksek) is a more secure environment for executable files. SuPHP is the...

How to get your php.ini path with SuPHP

.htaccess code Edit your public_html/.htaccess file and enter the appropriate code on a new...

What is php.ini

The php.ini file is a special file for suPHP (pronounced sue-p-h-p). The php.ini file is where...

PHP Memory limit error

Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 23456789 bytes)...

How do I clear my browser cache

Each time you access a file through your web browser, the browser caches it (stores it). In...