Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    90
    Thanks
    1
    Thanked 0 Times in 0 Posts

    mod rewrite excluding page

    I have this in mod rewrite:

    RewriteEngine on
    RewriteRule (.*)/(.*)$ /index.php?$1=$2 [L]

    However my web host provide a page mydomain.com/stats
    which provide web statistics.

    But the mod rewrite seems to screw this up, the stats url just displays the main page. (it works fine with mod rewrite disabled!)

    SO my question is: how can I modify this code so the page /stats is excluded!

    Thanks
    Daniel
    XZIST.org

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    330
    Thanks
    0
    Thanked 13 Times in 13 Posts
    This will exclude all real files and directories:
    Code:
    Options +FollowSymLinks
    
    RewriteEngine On
    
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?$1=$2 [QSA,L]

  • #3
    New Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    90
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have just tried it, and at first it seemed to work...

    But now I keep getting messages like

    "The requested URL /somedir/somefile.gif was not found on this server."

    as if mod_rewrite has been disabled... I have now reverted back to the previous .htaccess but the problem remains.

    It appears that modifying the .htaccess has somehow done this... Any ideas why?

    Thanks
    Daniel
    XZIST.org

  • #4
    New Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    90
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This is strange. I tried adding "RewriteBase /" and it's working. But I didn't have that before.
    Daniel
    XZIST.org


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •