I'm using Restler for building REST API on an Apache Server and I have some url rewrite problems.
Here are my directories :
/api:
/vendor
...
.htaccess (1st level)
/public :
/examples
/test
/src
.htaccess (2nd level)
/explorer :
/css
/images
/lib
index.html
Now, here is what I want :
1) I want an invisible "public" directory from the others.
For example a request like GET mydomain.com/api/data will pick it directly into mydomain.com/api/public/data
2) I want the root of "public" directory to be explorer/index.html but this file load a lot of resources in a relative way and sometimes it don't load.
So basically I want to access to /api/public/explorer/index.html with all the resources loaded if I only try to access to : mydomain.com/api
Here is what I have now :
Options +FollowSymLinks
AddDefaultCharset UTF-8
RewriteEngine On
RewriteBase /api/
RewriteCond %{REQUEST_URI} !^public/
RewriteRule ^(.*)$ /api/public/$1
For the first-level .htaccess, which seems to works pretty well
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/$ explorer/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors On
</IfModule>
For the second-level .htaccess
Any recommandations ? Thank you