Mapping yoursite.com to yourname.mysite.com

Using a single web hosting account to host multiple sites

Mapping yoursite.com to yourname.mysite.com

Postby ngungo » Tue Aug 05, 2008 7:18 am

I have searched but don't know what I am looking for. :) And here I found so similar.

My site is monpage.com. I would like to use tumblr as a blog service for my site. The URL would be monpage.tumblr.com. At tumblr, there offers a domain mapping service. So:

Yesterday, I set up a http://blog.monpage.com to point to a newly setup http://monpage.tumblr.com. Following instructions, all I did was that I have to have the A-record for blog.monpage.com pointing to their IP.

My question is how do they do that? The clever thing is keeping blog.monpage.com in the address box like a part of your site. With mod_rewrite? I would like to provide the same service to my clients. Thanks!
ngungo
 
Posts: 15
Joined: Sat Jun 02, 2007 4:44 am

Postby richardk » Wed Aug 06, 2008 4:15 pm

It's unlikely they used mod_rewrite for any of it (other than friendly URLs after the domain).

Both example.net and sub.example.com go to the same IP address. Then in the server configuration they will have a <VirtualHost> that matches those two (sub) domains and sends them to the right set of files.
Code: Select all
<VirtualHost *:80>
  ServerName sub.example.com
  ServerAlias www.example.net example.net

  DocumentRoot /path/to/files
</VirtualHost>


As it's a blog site, all domains and sub domains (with a few exceptions, like the main site) probably use the same files, then they only need one <VirtualHost> for them all (and one each for the exceptions).
Code: Select all
<VirtualHost *:80>
  ServerName _default_

  DocumentRoot /path/to/files
</VirtualHost>

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  DocumentRoot /path/to/main/site/files
</VirtualHost>


Then in their scripts they can use the HTTP_HOST variable as the username.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby ngungo » Wed Aug 06, 2008 5:33 pm

Thanks richardk!
I need some time to digest this then try it tomorrow. I'll let you know, and thanks again.
ngungo
 
Posts: 15
Joined: Sat Jun 02, 2007 4:44 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 1 guest

cron