If you have a SSL certificate installed on your domain and you would like to force your website visitors over to your SSL (HTTPS) to secure connections to your site, you can use the following code in your .htaccess file (Linux).
This will force all visitors to your website via the secure URL over https. Be sure to replace example.com with your actual domain name. If you do not wish for the www. to be included, remove the www. from the .htaccess rules below.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
Finally, if you want to force just a folder over to https, you can use the following rewrite rule. Be sure to replace example.com with your actual domain name.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R,L]
If you have any issues, please don't hesitate to contact us and we'll be glad to assist.
Looking for reliable Linux hosting with Award Winning Customer Support?
Grab your hosting today with a 20% discount. All plans come with our 60 Money Back Guarantee!
Check out our plans & promotions on our website -- https://www.peopleshost.com/