[UFO Chicago] Fun with Domains

Ian Bicking ianb@colorstudy.com
16 Aug 2002 03:30:03 -0500


The magic of mod_rewrite.  Something like:

RewriteEngine On
RewriteRule (.*) /var/www/html/%{HTTP_HOST}/$1 [L]

Then you get /var/www/html/crap.garfieldtech.com, etc.

Not tested -- try playing around.  Mod_rewrite documentation has an
apropos example, I believe.  You can do it with virtual hosting
directives as well (using name-based virtual hosts, as opposed to
IP-based), but I don't think that'll be necessary (though it can be more
convenient/powerful).

On Fri, 2002-08-16 at 03:23, Larry Garfield wrote:
> OK, so like, check it out.
> 
> I have a domain, garfieldtech.com, which is registered through PairNIC,
> and managed by their DNS servers.  www.garfieldtech.com is hosted at
> Pair Network's servers, on the account I have with them.
> 
> They also let me set custom DNS records, so I have home.garfieldtech.com
> pointing to the address of my router/NAT.  (I have RCN Cable Internet.) 
> It works nicely, and with port forwarding no one is the wiser that it's
> getting routed to my Linux box, which is running Apache.  (ncurses, now
> I've told you!)
> 
> Now, back when I was running DNS off of my Linux box itself, rather than
> a foreign system, and it had a real IP address instead of a NAT-created
> one, I was able, through some means I do not recall at the moment, to
> set up path-directing domain names.  That is, stuff.packrat.wox.org went
> to /var/www/html/stuff, crap.packrat.wox.org went to /var/www/html/crap,
> and so on.
> 
> Now, my question is, given my current setup, with foreign DNS hosting
> and a NAT in the way, can I still do that sort of setup?  If so, how? 
> Inquiring minds want to know!
> 
> Notes: The custom DNS support is a web front end to create A, CNAME, and
> MX records for their system.
> 
> -- 
> Larry Garfield			AIM: LOLG42
> lgarfiel@students.depaul.edu	ICQ: 6817012
> 
> -- "If at first you don't succeed, skydiving isn't for you." :-)
> 
> _______________________________________________
> UFO Chicago -- Users of Free Operating Systems
> Free Software Rules -- Proprietary Drools!
> http://ufo.chicago.il.us/cgi-bin/mailman/listinfo/ufo