And when the server's document root is set to project/webroot
everything runs fine. But I'm currently unable to change the
document root in the production server and so it is the project/
folder. So I created this .htaccess file there:

Here is what happens, when the server document root is set to
the webroot folder everything runs fine.

When the server document root is set to the Root folder weird
things happen.

If I browse to / then the / route works, as expected. If I
browse to /admin then the / route in slim is loaded again instead
of /admin (?). If I load /abcd (which doesn't exist) then the /
route is loaded again (?).

This happens with routes with up to 7 chars even if they don't
exist. If I load /1234567 it will still display the / route, but
/12345678 will 404 as I would expect.

So I created a new route in the app.php file:

$app->get('/12345678', function() use ($app) {
echo '/12345678';
});

And now when I open /12345678 I still get a 404 error (?).

I'm doing this on OS 10.7.4 using a default MAMP installation
with PHP 5.3.6 and Slim 1.6.4.

I'm not convinced this is a bug. I'm also not sure why you
would install a Slim app into a physical, public subdirectory but
access it with a request URI that did not include the physical
sub-directory path in the request URI. Can you? Sure. Why would
you? I'm not really sure.

I recommend that you either install Slim into the root of
your virtual host. If you choose to install it into a physical
sub-directory, then the physical path to the app must be present in
the request URI for Slim to parse the request URI
properly.

I'll use your suggestions and run some tests this weekend to
see what I can do without breaking existing apps.

I use the above setup for small sites, sometimes no more than just one page. But as mentioned earlier in this topic and at other places the routing just shows the main '/' page. It's a shame because I feel the Slim framework would be perfect for this situations.

I know there is (was?) an advice to use slim only in the root dir. But hat doesn't work for me. Also I've see some info on using the virtualhost but that's somehow complex because I do most in the plesk panel. Besides, to me this more technical workaround seem contrary to the main idea of a simple framework.

Perhaps I do something wrong here.
But hopefully this issue gets a better solution

I posted my ticket (#521) on Github, but the maintainer (codeguy) closed it without really responding to my concerns.

Honestly, after my own analysis, I came to the conclusion that it is a bug in the code and in the test that confirms the code. I patched it locally in order to allow me to move on with my own project, and haven't thought about it much since then.

Turns out the easiest way to use Slim in a subdirectory is
simply tack the path of the subdirectory into the mod_rewrite
command and leave everything else alone, except prepending the path
to any redirects within Slim.

Here's an example set of directories under the site_root. In
this case, I would be using Slim in a the "survey/music" directory
only to coordinate a survey

I had the same problem - on OSX w/ Apache & php 5.6.19
Fought this for more than a day.
Turns out that the .htaccess file in the local web site directory was conflicting with the virtual hosts config file for apache2 (/private/etc/apache2/extra/httpd-vhosts.confg)

So, I modified the vhosts config to have the following lines for 'localhost' and all is working fine.....