Sunday, 30 September 2012

How to redirect http to https in apache

 Just Add this line to end of your httpd.conf file

[root@station1 ~]# vim /etc/httpd/conf/httpd.conf
1025 RewriteEngine On
1026 RewriteCond %{SERVER_PORT} !443
1027 RewriteRule (.*) https://station1.ranjihat.com/ [R]
[root@station1 ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                             [  OK  ]

Thats it.. Open your webpage using http, you can observe the site will be automatically redirected to https.

No comments:

Post a Comment