Redirecting all requests to index.php, but overriding subdomain on another server

Discussion in 'Apache' started by escapecreative, Dec 3, 2011.

  1. #1
    I have all requests to domain.com AND www.domain.com being redirected to the index.php file (using the code below). It's working fine, however...

    I have clients.domain.com setup on a completely different server. I DO NOT want any redirect rules to apply to this subdomain, but right now, all requests for clients.domain.com are also being redirected to the index.php file on the server where domain.com resides.

    Here is my .htaccess code:

    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/index\.php$
    RewriteRule ^(.*)$ /index.php [L]
    
    Code (markup):
    Any help is greatly appreciated. Thanks guys!
     
    escapecreative, Dec 3, 2011 IP
  2. adimsh

    adimsh Member

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    48
    #2
    you should add another RewriteCond as in:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^clients.domain.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/index\.php$
    RewriteRule ^(.*)$ /index.php [L]
    Code (markup):
     
    adimsh, Dec 4, 2011 IP
  3. escapecreative

    escapecreative Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Perfect. Thanks a lot!
     
    escapecreative, Dec 4, 2011 IP