Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

CNAME based php hostingI have an application that lets users get a *.onemobi.net account (ex. bob.onemobi.net). Now what I would like to do is give the user the option of being able to use their own subdomain to point to their page (ex. bob.hisdomain.com => bob.onemobi.net). I have setup the server and bob.onemobi.net works as expected. I have added a CNAME entry for bob.hisdomain.com => g.onemobi.net (A record on my DNS server) but when I visit bob.hisdomain.com I automatically get redirected to www.onemobi.net. The default behaviour when a site does not exist is to show a page saying "Site does not exist" without any redirections.

I can't seem to be able to figure out what is causing this. I have tried looking around to see what could possibly be causing this but I'm lost as to what to search for. I'm hoping I can get some guidance from this community.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I think you are missing the ServerAlias directive for the bob.hisdomain.com, it should look something like this;

<VirtualHost *:80>

ServerName bob.onemobi.net
ServerAlias bob.hisdomain.com
...

</VirtualHost>

basically, because apache doesn't recognise the bob.hisdomain.com as explicitly aliased to some NameVirtualHost it falls through to the default *:80 NameVirtualHost which is presumably www.onemobi.net

share|improve this answer
    
Turns out there was a syntax error in my httpd.conf I added ServerAlias * to my vhost and it seems to be working now. –  Meisam Mulla Mar 6 '12 at 7:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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