1

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

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

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 abc.com zone file to point abc.mydomain.com, But it doesn't show the content of abc.mydomain.com. It shows Apaches default page ("It Works").

IN NS ns1.mydomainserver.net;
   @ IN CNAME abc.mydomain.com;

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

2
  • What domain is your Virtual Host set up to respond to in Apache?
    – Hyppy
    May 18, 2011 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 abc.com in this case. Use an A record with the same destination IP address as abc.mydomain.com instead.
    – the-wabbit
    May 18, 2011 at 13:18

3 Answers 3

1

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

<VirtualHost ip1 ip2>
   DocumentRoot /www/abs
   ServerName abc.mydomain.com
   ServerAlias abs.com
   ...
</VirtualHost>
0

You need the following to allow your app work with abc.com

You need to have a CNAME record for the abc.com domain that points to mydomain.com.

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

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

0

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .