The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wildacrd subdomains

Discussion in 'General Discussion' started by evilmonkey, Apr 29, 2006.

  1. evilmonkey

    evilmonkey Member

    Joined:
    Apr 28, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    I have a question about using wildcard subdomains. Basically, I want every possible subdomain of mytemplatespot.com to go back to the public_html directory of mytemplate sport.com, at which point it will be handled by mod_rewrite through a .htaccess file.

    I have a dedicated server with server beach, which provides thier own DNS service. I have set up the dns as *.mytemplatespot.com and pointed it to mytemplatespot.com. It wasn't working, I was getting the cpanel "no site at this address page". So then I set up Apache, and now my httpd.conf looks like this:

    Code:
    <VirtualHost 1.1.1.1> #(this isn't my actual IP)
    ServerAlias *.mytemplatespot.com #notice, I put the * character there
    ServerAdmin webmaster@mytemplatespot.com
    DocumentRoot /home/template/public_html
    BytesLog domlogs/mytemplatespot.com-bytes_log
    ServerName www.mytemplatespot.com
    
    User template
    Group template
    CustomLog /usr/local/apache/domlogs/mytemplatespot.com combined
    ScriptAlias /cgi-bin/ /home/template/public_html/cgi-bin/
    </VirtualHost>
    However, any subdomain of mytemplatespot.com still goes tot he apache "no site at this address" page. My htaccess looks like this:
    Code:
    php_flag register_globals off
    ErrorDocument 404 http://www.mytemplatespot.com/error.php?id=404
    php_value upload_max_filesize 5M
    RewriteEngine on
    RewriteCond   %{HTTP_HOST}        !^www\.
    RewriteCond   %{HTTP_HOST}        !^mytemplatesport\.com 
    RewriteRule   ^(.+)               %{HTTP_HOST}          [C]
    RewriteRule   ([^.]+)\.mytemplatespot\.com$ fwd.php?username=$1 
    What am I doing wrong? Feel free to check, mytemplatespot.com will give a phpinfo() page. Any subdomain will give the not found page.

    Thanks!
     
  2. evilmonkey

    evilmonkey Member

    Joined:
    Apr 28, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Well, this is one of those times where you do everything right, but neglect to read the last line in the instructions. RESTART APACHE!!! Wow, I'm frustrated. Thanks for looking, I hope this helps someone. :)
     
Loading...

Share This Page