dannyvankooten/PHP-Router — Issue #4: Minor matching fix
Author: Mnkras
Created: 2012-02-10 03:23:04+00:00
State: open

Was banging my head against a wall because of this (because I was blind)

https://github.com/dannyvankooten/PHP-Router/blob/master/Router.php#L88

on that line, you should add rtrim($var, '/'); around the getRegex and requesturl,

so:

if (!preg_match("@^".rtrim($route->getRegex(), '/')."*$@i", rtrim($requestUrl, '/'), $matches)) continue;

otherwise

/api/thing != /api/thing/ which can get annoying, (things that ended in wildcards work regardless though)