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

Re: [cobalt-users] Domains pointing at subdirectories of virtual site



On Saturday 26 January 2002 01:19 am, Craig Martin wrote:
> > > If I have a virtual site which has a number ( probably 12 ) of
> > > subdirectories is there a way I can point another domain name to each
> > > of these directories?
> >
> > Yes, since you have a Raq4 it's a lot easier, you can let the GUI handle
> > most of it, basiclly you need DocumentRoot in the server cconfig to point
> > into your subdirectory...
>
> ...and if the machine were a raq3 what would the trick be?
>

1. Create user "subdomain" in mydomain.com virtual site.

2. Create 'A' records in DNS for mydomain.com   "www.subdomain.mydomain.com"
   and  subdomain.mydomain.com

3. Create a file in /etc/httpd <anyname> I use mydomain.conf.
    Put the following text in mydomain.conf.
    <VirtualHost 111.222.333.444>
    ServerName www.subdomain.mydomain.com
    ServerAdmin admin
    ServerAlias subdomain.mydomain.com
    DocumentRoot /home/sites/siteX/users/subdomain/web
    RewriteEngine on
    RewriteCond %{HTTP_HOST}             !^111.222.333.444(:80)?$
    RewriteCond %{HTTP_HOST}             !^www.subdomain.mydomain.com(:80)?$
    RewriteRule ^/(.*)                   http://www.subdomain.mydomain.com/$1 
L,R]
   RewriteOptions inherit
   AddHandler cgi-wrapper .cgi
   AddHandler cgi-wrapper .pl
   </VirtualHost>

4. edit /etc/httpd/conf/httpd.conf
   add a line that states:
   "include domain.conf"  (without quotation marks)
   Add this line just under the main site VirtualHost Container.

5. reload httpd
   /etc/rc.d/init.d/httpd reload
   DONE

This method of creating subdomains is frontpage friendly, and the subdomains 
will come up in a frontpage edit of the main domain.

Modifications to httpd.conf (include file) will not be misinterpreted by the 
GUI, and the GUI will not mess with the include file.

-- 
Gerald Waugh
Registered Linux User 255245
Register at http://counter.li.org