In a similar way to codeigniter I want to catch all requests and rewrite them to an index.php file which sites in the root of my web accessible folder. Unlike the examples on codeigniter however I do not want to check whether the file exists before I rewrite it (because I dont want to allow direct access to any files).
I have had partial success using the following rewrite rule:
RewriteRule ^(.*)$ index.php/$1/ [L]
However the only way I can get it to work is by adding a rewrite condition before it which does some sort of check to make sure the request is not for index.php, otherwise I get a 500 internal server error. Ive had a look at the error log and it seems it is due to too much reccursion. I understand that if the request index.php it doesnt matter anyway because they will hit the right file but I dont understand the need for this condition and I feel dirty including it when I dont know why it has to be there?
The working rule is...
RewriteCond %{REQUEST_URI} !^/index.php/
Its also worth mentioning that this rewrite condition worked aswell but again I dont know why its needed!
RewriteCond %{REQUEST_FILENAME} !index.php