Force SSL on linux hosting with htaccess mod_rewrite
Posted by Premium Reseller on 10 September 2015 10:35 AM

After you set up ssl for website, you want users to access website via https only.

One way to redirect all http traffic to https is add configuration in .htaccess file in website home folder.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

Replace with your domain.

The following configuration will force https access on specific subfolder on your website

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} subfolder
RewriteRule ^(.*)$$1 [R,L]

(0 vote(s))
This article was helpful
This article was not helpful