Vanity Domain Names

Situation

An ISP provides customers with free web hosting by providing them with web sites rooted at http://home.isp.com/~username/. This is proving unpopular and the ISP wishes instead to offer http://www.username.isp.com/ without changing how they provide the web space.

Solution

Create a Virtual Server for home.isp.com and configure the home directories functionality to provide web sites rooted at ~username. Next, go to the fundamental configuration settings for the Virtual Server and add an alias of '*' to it, so it will catch requests for www.username.isp.com. Then add a request rewrite script similar to the following:

# Turn www.username.isp.com into home.isp.com/~username
match IN:Host into $ with ^www\.([^\.]+)\.isp\.com
if matched then
    set IN:Host = home.isp.com
    set URL = /~$1%{URL}
endif
# End rule for home directories

Explanation

The request rewriter executes the script for each request which is processed by the virtual server created above. For each request, the regular expression matching hostnames of the form www.username.isp.com is executed against the Host header. If that matches, then the regular expression captures the username into the $1 variable. If the regex matched, then two more actions are performed:

  1. The hostname is rewritten to home.isp.com;
  2. The URL portion has /~username prepended to it.
Content Manager [Administrator] 16 December 2005  Permalink  
Download Free Trial

Recent Articles

Other Resources



www.zeus.com