Wednesday, March 15, 2006

Hey Jekyll, Settle A Bet For Us?

Alk says there's a way to point a domain name at a subdirectory of another domain. For example:

www.abc.com
points to
www.xyz.com/folder
so that
www.xyz.com/folder
is the root of
www.abc.com

I told him there's no way to point right at a folder, you'd have to use some kind of redirector from the root of www.abc.com. What's the right answer?

14 comments:

SWong said...

Can www.abc.com be a virtual host with its site root at www.xyz.com/folder/? Are www.abc.com and www.xyz.com hosted by the same server daemon?

Gavin ・ ギャビン said...

All the DNS tools I've ever played with only permit setting an IP address as the site root. I've never seen anything that lets you set "111.222.333.444/folder" for example.

Will said...

There is no bet. You can do this, no doubt. If there's a limitation it is a policy limitation not a technical one.

Technically, HE.net, for example, has to do this to be able to host more than one site. I'm pretty sure they don't have a separate ip assigned to every account. I suspect they don't run a separate web server for each account either.

Can we do it at the dns server level? If so, we're golden.

The question, otherwise, is can we, us lowly users, configure the web server at he.net to redirect traffic for ambrosini.us to my root directory and traffic for digihotaru.com to a sub-directory?

(Tat, in any case, we need DNS to point my he.net account at some point.)

Is there some config file that I need to play with? I think I know how to do this with apache, but I don't know how to do it when I'm not king lord of the server (i.e. root).

Else, can we bribe a sysadmin at he.net to do this for us? :-)

SWong said...

Gavin is correct in that DNS records do not allow you to point at a specific directory. That's why you have to intercept the HTTP request for that site at the server, i.e. run a virtual host. It's pretty easy to do if you are running your own server.

That said, I highly doubt that any service provider will grant access to web configuration files.

Will said...

k, so right. we want to set up a virtual host.

Can I do that in a config file?

Ewww.... can I put the <virtualhost> directive in the .htaccess file?

Gavin ・ ギャビン said...

Maybe we're talking past each other. Yes, I've run multiple hosts off a single box for years. I do it here on campus, in fact. I simply aquire another statick IP addres, bind it to my NIC (yes you can bind more than one IP to a single NIC) and then tell IIS to listen on that new IP for a completely seperate website. This is what I understand to be a virtual host, but I gather this is not what you are talking about doing.

Gavin ・ ギャビン said...

Oh, and I have access to DNS controls for my domain, the trouble is you don't have another static IP at which I can point it, and I can't point it at a subdirectory.

I'm sure HE would consider getting another IP akin to getting another account, which we don't want to do simply because this is a temporary hold-over until I can host myself in Japan. :)

Will said...

Perhaps past each others we speak, yes.

Setting up a virtual host is definitely what we need to do. The question really is: will HE.net policy allow *me* to do so?

Cal, I have access to a web server config file of sorts... the htaccess file. I just don't know if I can set up a virutal host in that sucker.

I'd try it, but I can't easily set dns configuration.

Wanna try it, Tat?

Will said...

he.net lets me configure something called a zone file? Can I do what needs to be done with that file?

So I figured out how to create a sub-domain, but that's not really what we want.

Will said...

or... we could set up a sub-domain and <insert magic here> redirect your domain to that subdomain.

Proposed magic: use a domain parking service (i.e. like this one).

SWong said...

On the apache setups I've seen, the virtual hosts are set up in the httpd.conf file that governs apache's configuration, and the .htaccess files control directory access by user. I believe newer versions of apache offload the virtual host configuration to other config files, but these should not be accessible by a normal user.

At work, I have multiple hosts running off of the same IP. Some of these hosts contain over 150 virtual hosts (they all share the same site root).

Gavin ・ ギャビン said...

See. Here's what I propose since this is a short-term patch. All we care about for this little project is everything on my domain starting at www.digihotaru.com/blog

All you have to do is create a folder in your root called "blog". I'll move my contents into it, then change my A record to point at your server. Users will be none the wiser, because they don't go anywhere else anyway. In addition, none of our posting tools, etc. will break because everything is pointed at domain names. Simple.

Gavin ・ ギャビン said...

right, but I don't care about the root of the site. All I have sitting in my site root is a plain text doc named "index.html" that has the word "test" written in it. Here. All I really care about is everything from www.digihotaru.com/blog down. That holds the files for both my blog and this one.

Will said...

My space at he.net is a no-go for the '/blog' idea. My blog is in that directory.

Find your own directory. :-)

How long are we talking here? 1 or 2 weeks? If so, maybe just startup a blogspot, err, spot. It doesn't look like toc.blogspot.com is taken.

This will make all your links broken, but we can deal for a week or two. The upside is that the transfer can all be taken care of by blogger.