Changeset [12955a39b57d5811b29e41ee6e4455a21a2cf0fc] by Simon Lipp

February 28th, 2012 @ 10:36 AM

Allow to use base_uri option for url routing.

Right now, the following methods are used to determine request_uri(),
used in routing :

  • u or uri GET params
  • PATH_INFO (index.php/uri)
  • QUERY_STRING (index.php?/uri)
  • REQUEST_URI, which is just the equivalent of the two above methods but for webservers which doesn't set PATH_INFO or QUERY_STRING

The problem with this is that none is controllable via user

This patch modify the last method to try to use option('base_uri') in
addition to the internally computed base_path. For example, if
REQUEST_URI is /app/myroute and option('base_uri') is '/app', then
request_uri() (if not other methods are used) will return '/myroute'.

The main usage of this new method will be to allow rewrite rule of
this form :

RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L]

Which is the preferred method for "pretty"-urls in Nginx.

Committed by Simon Lipp

  • M lib/limonade.php
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Limonade is a PHP micro-framework.