jamieburchell Posted June 9, 2008 Share Posted June 9, 2008 Hi all Could someone please help me understand what's going on here. I would like the last rules of my config to pass the full url to a script that looks it up in a database to find the page that should be displayed. So I have the following rules: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-z0-9-/]+)/$ /index.php?c=page&url=/$1 [L] RewriteRule ^([a-z0-9-/]+)$ /index.php?c=page&url=/$1 [L] I put two lines here because I couldn't work out how to make /test/test and /test/test/ (with trailing slash) result in $1 being /test/test (no trailing slash) so that the database lookup works consistently. Anyway, if I create a directory called "example" with a default "index.html" file there and access it by going to /example, Apache tries processes the bottom two RewriteRules rather than getting the default index file. Very annoying and can't seem to find a way around this. I tried looking this up but haven't had much luck. Tried using the NS switch too on those lines to no avail. I am using Apache version 2.2.6. Any help greatly appreciated. Thanks Jamie. Quote Link to comment https://forums.phpfreaks.com/topic/109372-mod_rewrite-preventing-default-index-page-access/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.