mod_rewrite virtual subdomains

Discussion in 'Site & Server Administration' started by homebrewpc, Aug 27, 2008.

  1. #1
    Hello,

    I have gone through several websites on the internet trying to get this to work. I have the wildcard DNS set up, and here is my .htaccess:

    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).rdy.cc [NC]
    RewriteRule (.*) /red.php?id=%2&file=$1 [L]

    What exactly is wrong with that? It's completely right from things I've seen. Right now it just shows the Apache page: http://testit.rdy.cc

    Thanks for helping!
    HomebrewPC
     
    homebrewpc, Aug 27, 2008 IP
  2. LH-Danny

    LH-Danny Guest

    Best Answers:
    0
    #2
    Its pointing to your main IP address, I think. Create a new account on cPanel, add the domain to the account and change the nameservers on your domain.
     
    LH-Danny, Aug 27, 2008 IP
  3. homebrewpc

    homebrewpc Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm on a shared account. My main domain name is http://homebrewpcgaming.com/ I am hosted with MidPhase, I have rdy.cc pointed to dns1.midphase.com and dns2.midphase.com

    The main page works fine: http://rdy.cc
     
    homebrewpc, Aug 27, 2008 IP
  4. homebrewpc

    homebrewpc Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Got it to work, here's the solution:

    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !www.rdy.cc$ [NC]
    RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).rdy.cc [NC]
    RewriteRule (.*) red.php?id=%2&page=$1 [L]
     
    homebrewpc, Aug 28, 2008 IP
  5. homebrewpc

    homebrewpc Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I already got it working...
     
    homebrewpc, Aug 29, 2008 IP