mod rewrite conflicts with real folder

Discussion in 'Apache' started by mad4, Apr 18, 2006.

  1. #1
    I rewrite domain.com/product/ to domain.com/page.php3?id=product using the following htaccess

    RewriteRule ^(.*)/$ /page.php3?id=$1

    The problem is that I have a stats directory at domain.com/stats which is redwritten with this script as well.

    How can I solve this?
     
    mad4, Apr 18, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)/$ page.php3?id=$1
    RewriteRule ^stats/$ stats/ [L]

    If that doesn't fix it, the only way is having something uniqe in the fake URLs, like adding a directory, or extention.
     
    Nintendo, Apr 18, 2006 IP
  3. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I had already tried that but it failed. Over the last hour I fixed it using the following code.......
    RewriteCond %{REQUEST_FILENAME}  -d
    RewriteRule  ^.*$  -  [L]
    RewriteRule ^(.*)/$ /page.php3?id=$1
    Code (markup):
    This checks to see if there is a real directory before it applies the rewrite rule.:)
     
    mad4, Apr 18, 2006 IP