0

So everything is set up right at my dnsprovider. I have both my subdomain and my main domain directed to my ip. However I can't seem to get my subdomain to work with both with and without www.

If in my Apache2 configfile I use ServerName www.my.server.com then it works as www.my.server.com but not as http://my.server.com..

If I rename the server ServerName my.server.com it works the other way around. without the www that is..

However I want both www and not www to point to my subdomain. How is this achieved? Been looking all over the place for this info without result. Thanks!

  • This is because blah and www.blah are 2 totally different hostnames. You need an alias, like @LilloX beat me to. – Daniel Jan 7 '16 at 15:35
2

You have to use "ServerAlias" directive, so:

ServerName www.my.server.com
ServerAlias my.server.com
  • Can't believe a simple command like ServerAlias was so hard to find. Google failed me on this one but you came through. Thanks so much! – alexgilseg Jan 7 '16 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.