I've an installation of lighttpd under Debian running a small API. The current rewrite rules are:
url.rewrite = ( "^/(.*)\.(.+)$" => "$0", "^/(.*)$" => "/index.php/$1" )
The ideia is to (like usual on Apache):
- If any static file is called just serve the static file right away;
- If a URL is not found as a static file rewrite the request to
It works fine most of the times, however there's a problem, if the URL contains a DOT
. it will just treat it as a static file causing a 404 error (because of the first line).
How can I make sure this doesn't happen and the request is rewritten to
index.php? Also there are some conditions:
- I can't really predict the location of the static files, it should check if the file really exists not just "oh it has a dot, must be static" or "if folder X don't rewrite";
- The URLs might contain more than one dot, potentially a max of 5.