How To Force SSL On All Pages In .htaccess File
Forcing All Pages
You can force all of your pages to use HTTPS. To do this you will need to modify your .htaccess file.
Using the Code Editor in the File Manager, add these lines to the beginning of the .htaccess file.
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Forcing Specific Pages
To setup SSL protection on specific pages, you must edit the .htaccess file specific to that domain. For more information, please see Accessing the File Manager.
Edit The .htaccess File
Once you have found the .htaccess file in the file manager these steps will explain how to edit the file to add protection.
- Right-click on the .htaccess file and select the Edit option.
- A pop-up message will appear, then click the Edit button.
- At the top of the file insert the following code:
RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /[SSL Requested page]/ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
- Click the Save Changes button towards the top right corner of your screen.
- Check your website to ensure it is functioning as expected.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
Note: Be sure to replace example.com with your domain name. Don't forget to Save Changes when finished.