Skip to content

[Proposal] Remove the trailing slash in URL #58

Closed
@bpierre

Description

@bpierre

With the following URLs:

http://myapp.dev/admin
http://myapp.dev/admin/users

I can’t “hack” the URL by removing the users part of the second one, a 404 will be triggered because of the trailing slash:

http://myapp.dev/admin/

I think that “hackable URLs” are a nice way to interact with an application.

Proposal

The Router class could handle this: if a route is not matched, but the path ends with a slash, then try again to match the route after removing the trailing slash.

If the route exists, then redirect to the correct route, without trailing slash. Or maybe don’t even redirect, like GitHub does (it could be a setting):

https://github.com/laravel/framework/issues
https://github.com/laravel/framework/issues/

Router->dispatch() could handle this, or maybe Router->handleRoutingException().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions