Remove trailing slash from routes
Remove trailing slash from route (unless it's the root slash) before matching against routes. This ensures that both "/events" and "/events/" are matched with the route "/events"
This commit is contained in:
parent
26683559b4
commit
338c77594d
|
@ -27,8 +27,8 @@ class Route{
|
||||||
// Parse current url
|
// Parse current url
|
||||||
$parsed_url = parse_url($_SERVER['REQUEST_URI']);//Parse Uri
|
$parsed_url = parse_url($_SERVER['REQUEST_URI']);//Parse Uri
|
||||||
|
|
||||||
if(isset($parsed_url['path'])){
|
if(isset($parsed_url['path']) && $parsed_url['path'] != '/'){
|
||||||
$path = $parsed_url['path'];
|
$path = rtrim($parsed_url['path'], '/');
|
||||||
}else{
|
}else{
|
||||||
$path = '/';
|
$path = '/';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user