Slim 3 without URL rewriting

I’m using Monkey HTTP server which unfortunately does not implement url rewriting.
Tried following steps here:
Though root ‘/’ route works, all other routes don’t.

' => works!
' => goes to root route> goes to root route

By the way, also tested the same app with lighttpd server (which implements url rewrite), and everything works as expected.

Slim uses $_SERVER['SCRIPT_NAME'] and $_SERVER['REQUEST_URI'] to determine the route.
Maybe Monkey HTTP server does not set those properly?

Can you post the contents of the $_SERVER variable?


Contents of $_SERVER variable:
Array (
[USER] => nobody
[HOME] => /dev/null
[SERVER_SOFTWARE] => Monkey/1.6.9
[DOCUMENT_ROOT] => /usr/monkey/var/www/testsite
[SERVER_PORT] => 2001
[REMOTE_PORT] => 33516
[SCRIPT_FILENAME] => /usr/monkey/var/www/testsite/public/index.php
[SCRIPT_NAME] => /public/index.php/hello
[REQUEST_URI] => /public/index.php/hello
[HTTP_CONNECTION] => keep-alive
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
[HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch
[HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8
[ORIG_SCRIPT_FILENAME] => /usr/monkey/var/www/testsite/public/index.php/hello
[PATH_TRANSLATED] => /usr/monkey/var/www/testsite
[PHP_SELF] => /public/index.php/hello
[REQUEST_TIME_FLOAT] => 1466651738.7757
[REQUEST_TIME] => 1466651738
[argv] => Array ( )
[argc] => 0

Appreciate the help! Thanks :slight_smile:

If I check my Apache environment I see this:

// mine
[REQUEST_URI] => /info.php/blah
[SCRIPT_NAME] => /info.php

// yours
[REQUEST_URI] => /public/index.php/hello
[SCRIPT_NAME] => /public/index.php/hello 

Slim removed the SCRIPT_NAME from the REQUEST_URI and uses blah as the route.
In your case if you remove SCRIPT_NAME from the REQUEST_URI nothing it left!

I guess that’s what goes wrong.

I have no idea if this is a bug in your http server or not.

Nice observation, thanks!

Also noticed that there’s no entry for [PATH_INFO], any idea if this is used by Slim?
Anyway, I’ll try asking this from the Monkey forums too.

I don’t think PATH_INFO is used.

Checkout this method to see what is used: