I have following directory structure on my local LAMP:
www
- basic
- app
router.php
- public
index.html
- .htaccess
- app
- basic
and I can access my index page with localhost/basic/public/
and I am not using any virtual hosts.
Now I am trying to do two things:
Instead of
localhost/basic/public/
URL should look likelocalhost/basic/
to access homepage.All requests to
/api/
should be redirected torouter.php
. For example if I make a request like/api/user/login
it should go toapp/router.php
where I can execute specific code according to request for API.
To achieve this I was trying do something like following in .htaccess file but its not working:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/api/ [NC]
RewriteRule . ../app/router.php [NC,L]
Also I am not sure if we can use relative paths in RewriteRule
.