0

I have three virtual host sites enabled on apache2 all using TLS/SSL certificates. I want to redirect the non-ssl (http) to the ssl (https). I am using a redirect in each virtual host. All three .conf files are exactly the same as follows:

<VirtualHost *:80>
    ServerAdmin me@gmail.com
    DocumentRoot /var/www/html/site_folder/
    ServerName example.com
    ServerAlias www.example.com
    Redirect permanent / https://www.example.com/
</VirtualHost>

...and the ssl section down here which is working fine

I realize that I do not need to specify the DocumentRoot if I am using a Redirect in this way.

The problem is that two of the virtual hosts work perfectly and always redirect to https://www.example.com as I desire. However, one site does not. It simply redirects to https://example.com (without the www.)

So, I'm totally confused about this.

I have tried enabling and disabling the site (a2ensite, a2dissite), I have tried also to copy the whole file to a new site and create a new one, and restarting apache2 and the whole server. I am completely confused about this.

I'm Root James
  • 212
  • 3
  • 13
  • 2
    Clearly, your claim that all three .conf files are the same is incorrect, or else there's some other relevant configuration that you haven't shared. Please provide *all* the relevant configuration information. – womble Oct 02 '15 at 04:46
  • Well, that will reveal my DNS information for the sites I'm working on. – I'm Root James Oct 02 '15 at 05:15
  • I've actually taken out the line: "Redirect permanent / https://www.example.com/" from all 3 virtual hosts and they still route to the https automatically. The same one still goes without a www. Is there another place where this routing could be taking place? – I'm Root James Oct 02 '15 at 05:23
  • 1
    Yes, it could be happening in all sorts of places. Only you, as the person who set this up, can know for sure what else could be getting in the way. – womble Oct 02 '15 at 06:33

0 Answers0