WEB Why is this RewriteCond not working? .htaccess subdomains

Discussion in 'OT Technology' started by Insert Tokens, Aug 25, 2009.

  1. Insert Tokens

    Insert Tokens Making Cancer My Bitch OT Supporter

    Joined:
    Jan 12, 2006
    Messages:
    8,329
    Likes Received:
    76
    Location:
    Tasmania
    Helping a mate out.. his hosting has no access to subdomains apart from setting up a DNS entry to point xxx.yourdomain.com to your IP and then setting up a .htaccess file in the root catching xxx. requests and rewriting them to the directory you want..

    They sent us some buggy code for .htaccess but it just 500 errors.

    I've been googling and tearing my hair out over this for a few days now..

    This is what we currently have:

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On 
    Options +FollowSymlinks 
    RewriteBase / 
    
    RewriteCond %{HTTP_HOST} afg.domain.com$
    RewriteCond %{REQUEST_URI} !afg/
    RewriteRule ^(.*)$ afg/$1 [L]
    
    </IfModule>
    
    It diverts afg.domain.com properly, but 500 errors all subfiles/folders/etc.. so you can't go to afg.domain.com/index.html etc..

    HALP. :hsd:
     
  2. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,283
    Likes Received:
    500
    Location:
    L.A.
    check if file permissions are set to 777
     
  3. Insert Tokens

    Insert Tokens Making Cancer My Bitch OT Supporter

    Joined:
    Jan 12, 2006
    Messages:
    8,329
    Likes Received:
    76
    Location:
    Tasmania
    File permissions are fine, and I don't see how that could have anything to do with the .htaccess?

    It seems more like the RewriteCond is wrong and doesn't match anything after the xxx.domain.com/ .. you can load up the subdomain, and you get the index page, but you can't access any sub-page or any files under the subdomain at all.. they all just 500.
     
  4. Insert Tokens

    Insert Tokens Making Cancer My Bitch OT Supporter

    Joined:
    Jan 12, 2006
    Messages:
    8,329
    Likes Received:
    76
    Location:
    Tasmania
    Fixed it. Wordpress inserted a RewriteCond that diverted anything after a / to it's index.php, causing the subdomains to error 500 when no index.php was found.

    FU wordpress.
     
  5. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,283
    Likes Received:
    500
    Location:
    L.A.
    hosting companies dont allow you to have 777 permissions set so you get a 500 when u access them
     
  6. Insert Tokens

    Insert Tokens Making Cancer My Bitch OT Supporter

    Joined:
    Jan 12, 2006
    Messages:
    8,329
    Likes Received:
    76
    Location:
    Tasmania
    Ah, didn't know that.. ta.
     

Share This Page