If you are on a linux server and have .htaccess functionality enabled.

It's very easy to force redirect all the content from http:// to https://
Please create a file named .htaccess in httpdocs or root folder of your domain. If .htaccess already exits, please replace the following content with the content given in Example 1 and Example 2.


RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.ext/$1 [R,L]

Please ensure to check yourdomain.ext => your-actual-domain.com


Example 1: To force redirect entire website to https://, please use the rule code below

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.ext [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.ext/$1 [R,L]

Please ensure to change yourdomain.ext => your-actual-domain.com



Example 2: To force SSL redirect to a particular folder, please use the following rule code below

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.yourdomain.ext/folder/$1 [R,L]

Please ensure to change yourdomain.ext => your-actual-domain.com and /folder to be replaced with your actual folder name /billing etc


 




Was this answer helpful? 1 Users Found This Useful (1 Votes)