Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Permanent redirect from http to https in .htaccess  (Read 1724 times)

0 Members and 1 Guest are viewing this topic.

nirmal

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Permanent redirect from http to https in .htaccess
« on: December 29, 2013, 01:33:58 pm »
Hello Techies,

The following redirect rules can be used in the .htaccess for permanently redirecting http to https (secure connection) in Apache with SSL.

    RewriteEngine on
    RewriteCond %{HTTPS} !=on
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

or

    RewriteEngine on
    Options +FollowSymLinks
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^.*$ https://www.%{SERVER_NAME}%{REQUEST_URI} [L,R]

Thank you
Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!