-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slash at the end of url #74
Comments
Currently that is the way you'd have to do it - you could modify the router though if you like, adding something like the following inside the loop where the routes are matched in the
(I'm working on an update to the framework that is more robust to things like this, so it includes this code to make routes work with and without slashes) |
I did change which works for me - I think that we have trim rather url than route.
And in index.php all route should '/' at the end. |
the last solution of @pagodzik Works for me too |
You can modify the regex in the add function in Core/Router.php to achieve this. In this line: Add \/? before the $ to make the slash optional, like this: Now you can add your route in the index.php without the ending slash, and it will resolve to both URL cases. |
Hi
Is it possible that two urls:
mysite.com/admin
mysite.com/admin/
show the same?
I did
$router->add('admin/', ['controller' => 'Home', 'action' => 'index', 'namespace' => 'Admin']);
$router->add('admin', ['controller' => 'Home', 'action' => 'index', 'namespace' => 'Admin']);
but maybe there is simplier method?
The text was updated successfully, but these errors were encountered: