Author Topic: how to redirect non-ssl-enabled virtual hosts to default page  (Read 7923 times)

0 Members and 2 Guests are viewing this topic.

Offline
*
how to redirect non-ssl-enabled virtual hosts to default page
« on: November 11, 2015, 03:56:23 AM »
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

Offline
**
Re: how to redirect non-ssl-enabled virtual hosts to default page
« Reply #1 on: November 11, 2015, 09:57:59 AM »
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 ?

Offline
*
Re: how to redirect non-ssl-enabled virtual hosts to default page
« Reply #2 on: November 11, 2015, 01:30:35 PM »
If you're trying to redirect from https to http, try this code in .htaccess
Code: [Select]
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
Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]