1

I searched stackoverflow and google before posting this question.

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.

For example:

http://www.mydomain.com/event_name_1

http://www.mydomain.com/event_name_2

http://www.mydomain.com/event_name_3

Problem:

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.

For example:

http://www.myclientdomain.com should run http://www.mydomain.com/client_event_name

I am not looking for code examples, I need directions what are possible options, is it possible or not.

Irfan DANISH
  • 129
  • 1
  • 7

1 Answers1

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.

This is exactly how Google do it for Google Apps.

Dan
  • 15,430
  • 1
  • 36
  • 67
  • There is no automatic way to achieve this? Means any API, as normally my clients are not technical enough to configure their domains. – Irfan DANISH Jul 01 '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. – Dan Jul 01 '13 at 10:34
  • @IrfanDANISH Feel free to mark this as the answer ;) – Dan Jul 02 '13 at 11:08