I want that every call with
http://localhost/api/
(as root folder) for example http://localhost/api/get/users
act
Your (own) answer should be fine, just keep in mind that it will redirect all incoming URLs to index.php
. I.e. if you have static files, for example /js/jquery.js
then it will be changed to index.php?handler=/js/jquery.js
.
If you want to avoid problems try something like:
RewriteCond %{REQUEST_URI} !(.*)\.(css|js|htc|pdf|jpg|jpeg|gif|png|ico)$ [NC]
RewriteRule ^(.*)$ index.php?handler=$1 [QSA,L]
Please try to use the RewriteLog
directive: it helps you to track down such problems:
# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On
My favorite tool to check for regexp:
http://www.quanetic.com/Regex (don't forget to choose ereg(POSIX) instead of preg(PCRE)!)