Force redirection to SSL for websites

If you want to force your entire website to go through https, you can add these rules to your .htaccess file:

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


If your site is in a subfolder, use this code:

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


Simply replace yourdomain.com with your actual domain name.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing PHP 5.6 on Amazon Linux

Below are the steps I have used to update PHP version from 5.3 to 5.6 in Amazon Linux Steps...

Enabling SSL on Amazon Linux

For enabling SSL in Apache 2.4, run the following commandyum install mod24_ssl

Increasing Attachment size in Zimbra

For increasing size of attachments to 50 MB in Zimbra, a few settings need to be altered as...