0

I have my Amazon linux server and I had installed httpd24 and mod24_ssl. I had been setup ssl certificate in /etc/httpd/conf.d/ssl.conf file with https redirect instructions:

<VirtualHost *:80>
ServerName example.com:80
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>

<VirtualHost _default_:443>
ServerName example.com:443
SSLEngine on
SSLProtocol -All +TLSv1 +TLSv1.1 +TLSv1.2
SSLProxyProtocol all -SSLv3
SSLHonorCipherOrder on
SSLCertificateFile /etc/example.com/cert.pem
SSLCertificateKeyFile /etc/example.com/privkey.pem
SSLCertificateChainFile /etc/example.com/chain.pem
</VirtualHost>

But the httpd starts normally without any issue. But the redirection is not working. I have other file /etc/httpd/conf/httpd.confhere. What I might have missed.? I come across many articles but those didn't solve my problem.

0

The RewriteCond %{HTTPS} off line is superfluous, any traffic hitting that virtual host is going to be HTTP by definition. You probably also need a RewriteEngine on directive as well to enable mod_rewrite.

  • Yes. Silly mistake by me. Thanks much. I did changed and redirect is happening now but its giving too many redirects while loading the page. – Nagarjuna D N Aug 3 '16 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.