[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Tips: Setting up sub-domains for clients



PyschoCotic@xxxxxxx writes:

> That will keep the sub-domain in the URL box and look at files in ~hisclient 
> AND cgi-bin will work AND hisclient shares mydomain.com's disk quota.

Hmm, but at the dispense of creating a lot of extra sites (one for
each extra subdomain).

I created a simple set of rewrite rules, which lets me create tons of
subdomains (even using wildcard) without thinking of creating extra
sites (and possible hammering into that 275 site limit).

_But_ this doesn't quite work with email. It _does_ work if all you
want is a catch-all alias for each subdomain, and that's all I need.

This example requires that you do not use virtual sites:

RewriteEngine on
RewriteCond %{HTTP_HOST}                !^xxx\.xxx\.xxx\.xxx(:80)?$
RewriteCond %{HTTP_HOST}                !^www\.mydomain\.com(:80)?$
RewriteCond %{HTTP_HOST}                !^[^.]+\.mydomain\.com(:80)?$
RewriteRule ^/(.*)                      http://www.mydomain.com/$1 [L,R]
RewriteOptions inherit

RewriteCond %{HTTP_HOST}                ^([^.w][^.w]?[^.w]?[^.]*)\.mydomain\.com$
RewriteRule ^(.+)                       %{HTTP_HOST}$1  [C]
RewriteRule ^([^.]+)\.mydomain\.com(.*) /home/sites/siteXX/web/$1$2

Create a wildcard A record for your domain to point to the
IP-adress. Then you can just create a new directory under your web to
make a new functioning subdomain.

(this set of commands should be tweaked to allow for correct 404's,
personal/siteadmin under subdomains, etc.)


-- 
Jens Kristian Søgaard,
jk@xxxxxxxxxxxx -- http://www.jksoegaard.dk/
Søger du noget? -- http://www.google.com/
echo|perl -ple'$_+=4E-6*!int rand()**2+rand()**2while$i++-1E6'