I am developing a PHP/MySQL based dynamic conference website. Where users can register and create their own events for conference. Currently I have unique URL for each event and used .htaccess for that.

Now I want to change above implementations. Instead of using mydomain.com in URL I want to give users a feature where they can enter their own domain while using same code and database available on my server.

1 Answer
1

You're not trying to do anything too special, and it's definitely possible. The way in which this is generally achieved is as follows:

You configure a subdomain which is designed for receiving visitors redirected from an external domain. For example, external.mydomain.com. The page on the end of this will look at the headers and query the database to decide where to redirect to. If a user attempt to access directly, the page should return a 404, another error or redirect to your home page.

The user configures their domain (or subdomain, whatever) with a new CNAME record of external.mydomain.com

And finally, to prevent account hijacking, your service will normally generate some kind of verification code which the user adds as a TXT record.

There is no automatic way to achieve this? Means any API, as normally my clients are not technical enough to configure their domains.
–
Irfan DANISHJul 1 '13 at 10:05

Not really - you have no way of knowing what DNS service they're using and if it were possible, it would almost certainly be more complicated to set up their side than simply adding 2 DNS entries.
–
DanJul 1 '13 at 10:34

@IrfanDANISH Feel free to mark this as the answer ;)
–
DanJul 2 '13 at 11:08