Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running app on, when abc customer ask for instance of my app, I create a subdomain (like and put copy of app to that subdomain. That's fine.

When abc ask for their own domain like "", I need to point to

How do I do that ? My app is in php app runs on apache2.

I need to do this using CNAME recode

I tried putting CNAME recode to zone file to point, But it doesn't show the content of It shows Apaches default page ("It Works").

   @ IN CNAME;

What is the wrong with this? Is there any way to do this with-out touching vhost files on apache?

share|improve this question
What domain is your Virtual Host set up to respond to in Apache? – Hyppy May 18 '11 at 13:02
One note on handling CNAMEs: as a CNAME record will be valid for any RR type (not just A, but also TXT, MX and NS records), it should be avoided for RRs which will contain anything but the CNAME - like the record for in this case. Use an A record with the same destination IP address as instead. – the-wabbit May 18 '11 at 13:18

3 Answers 3

If you're not able to edit the virtual host entry for your website (and that's the best place to do this; see the other's posts), you'll need to do a redirect somewhere:

  •'s DNS "control panel" may have a "Web Redirect" type option you can do.
  • at's webserver (if it's setup/hosted somewhere), you can set the webserver it return HTTP 301 or 302 and (both Apache and IIS can do this)
  • you can put an index.php with header('Location:');
  • if PHP is not available, you can do a <meta http-equiv="refresh" content="0;url="> but this is not recommended.
share|improve this answer

You need the following to allow your app work with

You need to have a CNAME record for the domain that points to

You need to create a ServerAlias in your apache config, with

The first will have to be done by the owner/administrator of the The second should be on your own server.

share|improve this answer

You need to add an alias in the Vhost-config in Apache.

<VirtualHost ip1 ip2>
   DocumentRoot /www/abs
share|improve this answer

Your Answer


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.