[Phpwm] Web log analyser

Alastair Battrick al at aj8.org
Fri Nov 13 08:04:44 UTC 2009


Reuben Pearse wrote:
> I'm interested to find out more about the mod_rewrite rules to pipe all
> page requests through a single PHP page.
> 
> Do you have an example .htacess file?

Hello Reuben

Quite simple:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.php [L]

This tells Apache:
## Start doing rewrite stuff
## Don't rewrite if file exists
## Don't rewrite if directory exists
## Don't rewrite if link exists
## Rewrite everything to /index.php (and the [L] tells it to stop 
processing rules now)

You can also put this in there (before the !-f line) to limit this to a 
certain directory only. NC tells it to be case insensitive:

RewriteCond %{REQUEST_URI} ^/dirname/ [NC]

Hope that helps
Al



More information about the Phpwm mailing list