Slim 3 Framework - hosted in subdirectory

Asked

Viewed 390 times

0

I have an api hosted on the local development machine in the following directory:

root/www/api/v2

If I access by serving by apache, my routes are not recognized, not even if I access by http://localhost/api/v2/route nor by http://localhost/api/v2/index.php/route

If I can access it by php -S 0.0.0.0 (buit-in server) works, however, another problem occurs, rewrite mode of apache . htaccess does not work if I try to pass a parameter with the character. (dot) it gets lost, an example would be to pass an email or domain in the parameter.

Unfortunately my development environment in the company is windows, already researched that is likely a problem even with OS. Has anyone been through anything like it or has a reasonable solution?

  • I do not believe in the problem in OS, because, I have application running Slim with Windows and works the routes naturally, of course configured on my server. This is kind of Setup. I ask you run your server in the root folder of the slim application ?

  • The api is in root/www/api/v2/public. I am using slim 3 with the latest version of XAMP and the latest WAMP too. In slim 2 works normally.

  • You created . htaccess as described in this link: http://www.slimframework.com/docs/start/web-servers.html

  • Yes, I’ve even tried many other ways.

  • The problem is funny because I just installed slim3 and it works with my server and with the command php -S localhost:85 perfectly ... !!! I’m not sure what it could be

  • Then try php -S localhost:85 with the following route: http://localhost:85/test/[email protected] - Of course you should create the test route with a $app->get('/test/:email', Function ($email) { echo $email; });

  • I created the route, I made examples of routes and tested, worked perfectly!

  • Create a normal route and a unique directory and configure these servers of yours that will run!

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.