.htaccess - PHP Slim API 404 not found -


i'm trying create api using php , php slim.

my folder structure:

api:

  • app -> app.js
  • libs -> slim
  • v1 -> .htaccess , index.php

htaccess

rewriteengine on  rewritecond %{request_filename} !-f  rewriterule ^(.*)$ %{env:base}index.php [qsa,l] 

index.php

require '.././libs/slim/slim.php'; \slim\slim::registerautoloader();  $app = new \slim\slim(); $app = \slim\slim::getinstance();  $app->get('/orderoverview/:customerid', function ($customerid) {         echo "hello " . $customerid;  }); $app->run(); 

this should easy every time go http://localhost/api/v1/orderoverview/2 404 page not found.

but when go http://localhost/api/v1/index.php/orderoverview/2 result want become!

any remarks or solutions?

you need add rewritebase htaccess. noticed don't have grouping, assume placing in subdirectory of /api/v1

rewritebase /localsites/serf/weap/api/v1 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -