I have a development server for a website I am re-developing with an API backbone. I want the domain to be protected from outside access, so I require a valid htpasswd user on all domains hosted on the dev server.
This causes problems though because the PHP scripts cannot access the API to run the application. The API is located at dev.example.com/api, but this is not an actual directory because everything is controlled by a PHP URL router. I have not been able to allow access to only the API with Apache because the files are not located in an actual directory. This is what I tried
<VirtualHost *:80>
ServerName dev.example.com
DocumentRoot /path/to/dir
<Location /api>
Order allow,deny
Allow from all
Satify any
</Location>
</VirtualHost>
This is what I had for my old site's development server, but it only worked because the API wasn't controlled by a router but actually located at /path/to/dir/api
.
Is there a way to allow access to the API from outside sources (any call to the domain dev.example.com/api)?