Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apache virtualhost SSL + non-SSL [closed]

I'm having trouble figuring out what's the proper way to setup a SSL virtual host + a non-SSL copy of it.

I have it like this now:
<VirtualHost myip:80>
plenty of directives here
</VirtualHost>

and

<VirtualHost myip:443>
same directives as above
</VirtualHost>

And it works fine but every time I edit the directives in one of the vhosts, I must do it in the other as well. Anything cleaner and more elegant?

like image 239
Amati Avatar asked Apr 30 '12 17:04

Amati


1 Answers

To run a website on both HTTP and HTTPS URLs, your only option is to run 2 separate VirtualHosts with the same DocumentRoot.

If the directives context allows, you can keep some of the common settings in a .htaccess file in a folder that is parent to both DocumentRoots.

like image 105
rightstuff Avatar answered Nov 14 '22 11:11

rightstuff