Forum Moderators: phranque

Message Too Old, No Replies

dynamic virtualhost

         

slivka

8:52 pm on Mar 20, 2011 (gmt 0)

10+ Year Member



Hello,

I have this configuration of virtualhost on my server. Everything works correctly except subdomain with www. When I go to URL with www I get the 404 error. I tried to solve this problem with mod rewrite but I did not know how to do it. Could someone help me? Thanks.

<VirtualHost *:80>
ServerAdmin mail@localhost
ServerName domain.com
ServerAlias www.domain.com
UseCanonicalName Off
VirtualDocumentRoot /var/www/domain.com/www/
</VirtualHost>

<VirtualHost *:80>
ServerAdmin mail@localhost
ServerName *.domain.com
ServerAlias *.domain.com
UseCanonicalName Off
VirtualDocumentRoot /var/www/domain.com/sub/%-3+
</VirtualHost>

jdMorgan

10:52 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ServerAlias www.domain.com
conflicts with
ServerAlias *.domain.com

You did not say why you have a server alias in the second vHost, so I cannot tell you how to resolve this conflict.
I would guess you should either delete the second ServerAlias, or change it to
ServerAlias www.*.domain.com

Jim