mod_rewrite, yet again. need help

Discussion in 'Apache' started by dejangex, Jun 9, 2009.

  1. #1
    Basically, what I need to do is this:

    When someone types http://domain.tld/whatever.whenever
    it needs to rewrite to a page like this: check.php?query=whatever.whenever
    But this should exclude http://domain.tld/ and http://domain.tld/index.php
    Because in these cases index.php is displayed. Ive been trying for several hours and cant seem to get it work although Ive read many tutorials, and everything seems logical :confused:
    
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} !^$
    RewriteCond %{REQUEST_URI} !index\.php
    RewriteCond %{REQUEST_URI} !check\.php
    RewriteRule ^(.*)$ check.php?domain=$1
    Code (markup):

     
    dejangex, Jun 9, 2009 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Try with [L] at the end of each Rule (to stop looking for new rules).
    Example:
    
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^$ index.php [L]
    RewriteRule ^index\.php$ index.php [L]
    RewriteRule ^(.+)$ check.php?domain=$1 [L]
    
    Code (markup):
     
    ajsa52, Jun 17, 2009 IP