how to redirect non-ssl-enabled virtual hosts to default page

Started by tamha, November 11, 2015, 03:56:23 AM

Previous topic - Next topic

tamha

Hello,

I have a shared hosting with openssl support. I have some websites with ssl and some with non-ssl.
How do I prevent HTTPS requests for non-ssl-enabled virtual hosts from going to the first ssl-enabled virtualhost (setup is Apache-SNI).
Or how can i redirect non-ssl websites to default page?

Thanks

Glenn

Hi do you only have one site on the server (ssl) if you redirect http traffic to the default page no sites will work except for the one https , or did i miss something in your question ?

Mihai

If you're trying to redirect from https to http, try this code in .htaccess
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


Otherwise, if you're trying to get redirect from http to http, try this one
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]