0

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)?

user229044
  • 232,980
  • 40
  • 330
  • 338
Sam
  • 20,096
  • 2
  • 45
  • 71
  • 1
    If understood right, directive `` is pointing to a non-existent directory and "*everything is controlled by a PHP URL router*". How? There has to be some code somewhere that redirects all requests to that router. That's the code you may want to post to look for a way to exclude the requests to `/api` directory. – Felipe Alameda A Apr 26 '13 at 02:24
  • @faa thanks and sorry for the late response. I am somewhat of an htaccess/Apache beginner, but this makes sense and I should be able to make it work. – Sam Apr 29 '13 at 14:32

0 Answers0