I've got a site which allows for ssl and non-ssl browsing.
I've got two virtualhosts set up in Apache to handle the two scenarios, ie:
<VirtualHost *:80>
...
</VirtualHost>
and
<IfModule mod_ssl.c>
<VirtualHost *:443>
...
</VirtualHost>
</IfModule>
Now, my annoyance is that the (rather large) configuration is duplicated in both the vhosts (the only difference being the added SSL parameters in the ssl-vhost), so when I want to change something, I need to do it in both. It also feels and looks sloppy.
Is there any way to merge the two configurations?
Many thanks.
Yes, this is needed as mentioned by @Hex in his comment.
However, you can take a shortcut and use the
Include
directive to not have the common configuration redundant, like this:Stolen from the pretty much similar question "Do I have to duplicate the Virtualhost directives for port 80 and 443?".