Results 1 to 14 of 14
  1. #1
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66

    SubDomains Driving Us Nuts...

    We have searched the archives, the 'net, etc. So many different solutions and nothing seems to work.

    Here is what we are attemping to do (and we know it's been done before):

    We want to add a clients site to the RaQ4r. Then, make an edit to the httpd.conf, or wherever, so that subdomains will be automatic.

    What I mean by automatic is that we will not have to be involved in setting up a clients A record everytime they want another subdomain.

    Here's an example:

    Let's say we are hosting the domain "domainname.com". Now, the client wants to have a few sub-domains. So, all they would have to do is create a folder with the name they want in their main "/web" folder, then instruct people to go to http://folder.domainname.com and they would successfully be sent to the proper folder.

    Can someone point us to something that is KNOWN to work?

    We would really appreciate it as this is a problem that has plagued us for two full days now and driving us nuts!!

    Thank you...
    Last edited by COMPUTICA; 09-28-2002 at 12:20 AM.

  2. #2
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    1,354
    It is possible to do this using a couple of the RAQ control panel extensions that are available.

    There is no 'simple' solution to allow clients to do this without the help of some third party software.
    As far as I know the two scripts that would allow this are:
    Shadm and OmairHarroon
    (sorry if they are mis-spelt, but I didn't get a chance to check the spelling)
    Blacknight
    ICANN accredited domain registrar

  3. #3
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66
    I have been struggling with the following:

    http://www.webhostingtalk.com/showth...ght=subdomains

    Apparently this is supposed to work.....but I can't get it to for anything.....

    Anyone else using this method?

  4. #4
    Join Date
    Sep 2001
    Posts
    238
    If you modify that idea like this:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} *.domain.com [NC]
    RewriteCond %{HTTP_HOST} !www.domain.com [NC]
    RewriteRule ^/(.*)$ /home/sites/www.domain.com/%{HTTP_HOST}/$1 [L]
    ServerAlias *.domain.com

    Then you can create sub.domain.com folders parrallel to your web folder, I think. I didn't try it.

  5. #5
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66

    That didn't work....

    Here is exactly what I did....maybe it will work, but I am just doing something wrong.....

    Original httpd.conf entry:

    -----

    <VirtualHost xxx.xxx.xx.xx>
    ServerName www.domain.com
    ServerAdmin admin
    DocumentRoot /home/sites/siteXX/web
    ServerAlias domain.com www.domain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^xxx.xxx.xx.xx(:80)?$
    RewriteCond %{HTTP_HOST} !^www.domain.com(:80)?$
    RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
    RewriteOptions inherit
    AliasMatch ^/~([^/]+)(/(.*))? /home/sites/siteXX/users/$1/web/$3
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php .php
    # AddHandler chiliasp .asp
    # AddHandler chiliasp .asa
    </VirtualHost>

    -----

    Modified httpd.conf entry:

    -----

    <VirtualHost xxx.xxx.xx.xx>
    ServerName www.domain.com
    ServerAdmin admin
    DocumentRoot /home/sites/siteXX/web
    ServerAlias domain.com www.domain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^xxx.xxx.xx.xx(:80)?$
    RewriteCond %{HTTP_HOST} !^www.domain.com(:80)?$
    RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
    RewriteOptions inherit
    AliasMatch ^/~([^/]+)(/(.*))? /home/sites/siteXX/users/$1/web/$3
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php .php
    # AddHandler chiliasp .asp
    # AddHandler chiliasp .asa
    RewriteEngine on
    RewriteCond %{HTTP_HOST} *.domain.com [NC]
    RewriteCond %{HTTP_HOST} !www.domain.com [NC]
    RewriteRule ^/(.*)$ /home/sites/www.domain.com/%{HTTP_HOST}/$1 [L]
    ServerAlias *.domain.com
    </VirtualHost>

    -----

    After modifing and saving file, I stopped httpd and started httpd.....didn't just do the restart....did the whole stop and start process.

    When trying to start, I get an error message about the "*.domain.com" and httpd will not start.

    Maybe a reboot would fix it??? No?

    Any ideas are helpful and appreciated....

  6. #6
    Join Date
    Sep 2001
    Posts
    238
    You have 2 serveralias lines, try editing the first one to include what the second one has.

  7. #7
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66
    Tried...........got the following error again....

    -----
    Setting up Web Service: Syntax error on line 729 of /etc/httpd/conf/httpd.conf:
    RewriteCond: cannot compile regular expression '*.domain.com'

    /usr/sbin/httpd
    -----

    Here is what I changed it to...

    -----
    <VirtualHost xxx.xxx.xx.xx>
    ServerName www.domain.com
    ServerAdmin admin
    DocumentRoot /home/sites/siteXX/web
    ServerAlias domain.com www.domain.com *.domain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^xxx.xxx.xx.xx(:80)?$
    RewriteCond %{HTTP_HOST} !^www.domain.com(:80)?$
    RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
    RewriteOptions inherit
    AliasMatch ^/~([^/]+)(/(.*))? /home/sites/siteXX/users/$1/web/$3
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php .php
    # AddHandler chiliasp .asp
    # AddHandler chiliasp .asa
    RewriteEngine on
    RewriteCond %{HTTP_HOST} *.domain.com [NC]
    RewriteCond %{HTTP_HOST} !www.domain.com [NC]
    RewriteRule ^/(.*)$ /home/sites/www.domain.com/%{HTTP_HOST}/$1 [L]
    </VirtualHost>
    -----
    COMPUTICA International - http://www.ComputicaInternational.com
    COMPUTICA Hosting - http://www.ComputicaHosting.com
    COMPUTICA Marketing - http://www.ComputicaMarketing.com
    COMPUTICA Computers - http://www.ComputicaComputers.com (Canadians Only)

  8. #8
    Join Date
    Sep 2001
    Posts
    238
    Change
    RewriteCond %{HTTP_HOST} *.domain.com [NC]
    to
    RewriteCond %{HTTP_HOST} (.*).domain.com [NC]

    I THINK that will do it.

  9. #9
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66

    Half Way There....

    Okay, tried your latest tip and now I can get httpd services restarted successfully......but it still doesn't appear to work.

    Here is what the file says currently:

    -----
    <VirtualHost xxx.xxx.xx.xx>
    ServerName www.domain.com
    ServerAdmin admin
    DocumentRoot /home/sites/siteXX/web
    ServerAlias domain.com www.domain.com *.domain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^xxx.xxx.xx.xx(:80)?$
    RewriteCond %{HTTP_HOST} !^www.domain.com(:80)?$
    RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
    RewriteOptions inherit
    AliasMatch ^/~([^/]+)(/(.*))? /home/sites/siteXX/users/$1/web/$3
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php .php
    # AddHandler chiliasp .asp
    # AddHandler chiliasp .asa
    RewriteEngine on
    RewriteCond %{HTTP_HOST} (.*).domain.com [NC]
    RewriteCond %{HTTP_HOST} !www.domain.com [NC]
    RewriteRule ^/(.*)$ /home/sites/www.domain.com/%{HTTP_HOST}/$1 [L]
    </VirtualHost>
    -----

    I then made a folder of test here: /web/test.domain.com

    Tried accessing: http://test.domain.com - Didn't work

    I then made a folder of test here: /test.domain.com - Didn't work

    Completely rebooted the server - Still didn't work

    Added a A record in the DNS for "test" - Didn't work


    Ideas?

  10. #10
    Join Date
    Sep 2001
    Posts
    238
    #1: The DNS entry has to be there.
    #2: Move your second group of RewriteCond/RewriteRule lines up a bit. like so:

    -----
    <VirtualHost xxx.xxx.xx.xx>
    ServerName www.domain.com
    ServerAdmin admin
    DocumentRoot /home/sites/siteXX/web
    ServerAlias domain.com www.domain.com *.domain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} (.*).domain.com [NC]
    RewriteCond %{HTTP_HOST} !www.domain.com [NC]
    RewriteRule ^/(.*)$ /home/sites/www.domain.com/%{HTTP_HOST}/$1 [L]
    RewriteCond %{HTTP_HOST} !^xxx.xxx.xx.xx(:80)?$
    RewriteCond %{HTTP_HOST} !^www.domain.com(:80)?$
    RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
    RewriteOptions inherit
    AliasMatch ^/~([^/]+)(/(.*))? /home/sites/siteXX/users/$1/web/$3
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php .php
    # AddHandler chiliasp .asp
    # AddHandler chiliasp .asa
    </VirtualHost>
    -----

    That placement should keep the first Rewrite from sending the site to www.domain.com before the second rewrite set kicks in.

  11. #11
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66
    Tried.....didn't work.

    When I attempt to go to: http://test.domainname.com, all I get is a page not found error......
    COMPUTICA International - http://www.ComputicaInternational.com
    COMPUTICA Hosting - http://www.ComputicaHosting.com
    COMPUTICA Marketing - http://www.ComputicaMarketing.com
    COMPUTICA Computers - http://www.ComputicaComputers.com (Canadians Only)

  12. #12
    Join Date
    Sep 2001
    Posts
    238
    Ok, I officially give up. Maybe if you look over http://www.apache.org you can figure it out.

  13. #13
    Join Date
    Jul 2002
    Location
    Saskatchewan, Canada
    Posts
    66
    I appreciate the help!

    If only some of you that have got this working already would post or PM me, that would be greatly appreciated.....

  14. #14
    Join Date
    Sep 2001
    Posts
    238
    Post preferably, I want to use this technique now too. Preferably as a redirect for users as Apache shows in examples.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •