Forum Moderators: buckworks & webwork

Message Too Old, No Replies

Letting users use their own domains with our service

         

Nastar

2:27 am on Jun 28, 2007 (gmt 0)

10+ Year Member



Hi everybody,
I <provide a hosted service> and I want to add this feature so that if a user has his own domain, he can update the "A record" of his domain name and point it to my server IP, and he can access <the service> with his domain.

For example, my site is http://example.com, and a user's site is created at http://example.com/site.php?blog_id=1234 (1234 is his site id). When this user add his own domain to his account, say example2.com (his own domain), and update his domain's A records to point to my server IP, he can enter [example2.com...] and go to his site like when he enter http://example.com/site.php?blog_id=1234.

How can this be implemented with cPanel/WHM, Apache? Or if you could refer me to some useful information on this I would be grateful. I'm a programmer so sorry for my ignorance.

Thanks for any reply :)

[edited by: buckworks at 6:58 am (utc) on June 28, 2007- Used Example.com - it will never be owned]

[edited by: Webwork at 10:49 am (utc) on July 2, 2007]
[edit reason] Generalized issue [/edit]

jtara

7:10 am on Jun 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately, it's impossible to give you general advice on this. The place to look for the answer is in the documentation for your blogging software. Apache configuration alone is not going to be sufficient.

You'll most likely need to use mod_rewrite, as well as set some configuration option or options in your service/software.

[edited by: Webwork at 10:50 am (utc) on July 2, 2007]
[edit reason] Generalized issue [/edit]

vincevincevince

7:18 am on Jun 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Get yourself a dedicated IP and configure Apache's httpd.conf file to send all requests to that IP to a single domain, i.e. you are doing old-fashioned IP based hosting. In that way, whatever domain has an A record pointed at that IP will show that content. Next step is to edit your script... if it's PHP you will want to use $_SERVER[HTTP_HOST] - a variable which automatically tells you the domain which is being used - i.e. example.com or something.foo. Use this HTTP_HOST value to decide which database, template, etc. to display for the blog. i.e. instead of?blogid=123, you do a lookup for what the HTTP_HOST value is, get the related blogid from that HTTP_HOST, and then feed that into your script in place of the GET value.

Nastar

8:49 am on Jul 2, 2007 (gmt 0)

10+ Year Member



@jtara: we make this script ourselves (using PHP), but I think in order to enable this we'll need more than what PHP can provide, so.. :)

@vincevincevince: thanks very much for your solution, seems like I can figure out how to make it the way you describe :)

If anyone has any other solution please post it here. That would be nice to learn more about this.

[edited by: Webwork at 10:51 am (utc) on July 2, 2007]