HTTP and HTTPS should I have 2 sites in Virtualmin?

Okay so I’ve been told my website in HTTP and HTTPS is responding with a code 200 and that I should choose one.

So now I’m looking in virtualmin and see that I have 2 websites for the same domain name, one for HTTP the other for HTTPS. Explains why they are both answering 200.

Did I set this up wrong?

If so what is the proper course of action to address this?

Thanking you kindly in advance,

SR

Can you explain “respond with code 200 and you should choose one”? Who/what is telling you that and where?

Normally you access the HTTP site on port 80 and HTTPS on port 443. You don’t need to “choose one” really, they both work at the same time.

Hi Locutus,

I got that advice on the google webmaster forum:

https://www.mysite.com/ responds with 200 just like http://www.mysite.com/ . You need to decide whether you want the site to be indeed with https or http and enforce it with 301 redirection from the non-preferred protocol to the preferred one for every single url. Some urls might need to be with http and other with https. They should never be accessed both ways without a 301 redirection to the preferred way.

Now, is it okay that in virtualmin I have 2 seperate websites one port 80 and the other 443 with the same name? (See attached)

Thanks!

SR

Yes that’s okay… they are two separate virtual hosts in Apache, but they point to the same DocumentRoot, so they essentially serve the same website. This is the way Virtualmin sets it up when you use https.

Except you wish to force your users to use https, in which case you’d create a redirect in the http site ushering the browser to the https URL.

Actually it is the other way around, I’d like to force the traffic to http and only use https for customers who login or want to checkout.

Do I set this up in virtualmin or do I need to do this through the .htaccess file?

Much appreciated!

SR

You can create redirects in Virtualmin’s https site too, yes. You just need to make sure to use a proper redirection URL, so as only to redirect people other than “customers who want to login or checkout” to http.