I have a .htaccess rule that basically points all access through one page, and I have PHP handling it from that point. So, no matter what directory it is in, it'll pass all URLs to this script.
If my root was /project/ ( example.com/project/some/page/where ), /some/page/where would get redirected to @frontend.php
RewriteRule !\.(js|ico|gif|jpg|png|css|pdf|swf|doc)$ @frontend.php
I've reached a point however, where I want to be able to push a subset of pages through to a different handler, like so ( example.com/project/api/page/where, not example.com/project/some/api/where ):
RewriteRule ^/api?$ @api.php
Problem is, this does not work, no matter if this rule is above or below the other one. Can anyone suggest how I would be able to do this?
I have also tried:
RewriteRule ^/api(/.*)? @api.php [L]
RewriteCond %{REQUEST_URI} !/api
RewriteRule !\.(js|ico|gif|jpg|png|css|pdf|swf|doc)$ @frontend.php [L]
And while this works in that http://example.com/project/api/page/where doesn't get pushed to @frontend.php, it doesn't get it to @api.php, and produces:
[Wed Apr 18 10:46:12 2012] [error] [client 127.0.0.1] File does not exist: /www/project/api
EDIT:
My latest attempt is:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api(/.*)? @api.php [L]
RewriteCond %{REQUEST_URI} ^api
RewriteRule !\.(js|ico|gif|jpg|png|css|pdf|swf|doc)$ @frontend.php
The problem with this one is that if the URL starts with anything except api/, like ( example.com/project/test/page/where ) it throws the error:
[Sat Apr 21 10:50:13 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/www/projects/frame3/test