subdomains and mod_rewrite

Discussion in 'Site & Server Administration' started by romance, Sep 25, 2006.

  1. #1
    Hi all

    could be posted in apache forum as well but thought i'd try here and see if a mod moves it

    I'm trying to setup mod_rewrite for domains so that

    www.domain.com/city.php?name=foobar

    appears as

    foobar.domain.com

    with www being left alone. I've seen numerous examples of how to do this, but can't test any due to being stuck on the first step, wildcard subdomains..

    from WHM i've added a dns zone entry as follows:

    *.domain.com. 14400 IN CNAME domain.com.

    now, when going to foobar.domain.com i see the standard cpanel 'there is no site configured at this address' page. Is my zone entry wrong? I've added a redirect example as below:

    RewriteCond %{HTTP_HOST} !^w{3}\. [NC]
    RewriteCond %{HTTP_HOST} ^([^.]+)\.australia-source\.com$ [NC]
    RewriteRule ^.*$ /city.php?name=%1 [L]

    but again, nothing happens apart from seeing the cpanel placeholder page for any non-www subdomain. any pointers appreciated!
     
    romance, Sep 25, 2006 IP