Comments (7)
Just don't use trailing slashes.
from framework.
I have been having the same issue when you create Resource Controller using Route::resource('test', 'TestController') and creating the controller using ''php artisan controller:make TestController".
Then when you browse to /test or /test/create or /test/1 it works fine but when you add a trailing slash like /test/ or test/create/ it throws NotFoundHttpException.
Just wondering if this will remain how it is or if it is a bug to be fixed?
from framework.
I'm also having the same issue, anything with a trailing slash doesn't route and just shows an error.
from framework.
Duplicate content has to be taken into account when handling this. The proper solution, if anything, would be to redirect to one of the two variants (but only if the other one of them is defined).
from framework.
I don't think that's really a solution. Users may use trailing slashes. We may construct our URLs specifically forgoing them, but a user may still type a URL that includes one. We should be able to cope.
Traditionally, the segments of a URL are emulating the folder structure. Where although /example/docs/routing
may be a page on the documentation, /example/docs/
is considered the main index of the documentation and it would be reasonable to expect a page to exist there. The URL structure /example/docs
would indicate that docs
is a page of the example
section, when it is actually an index in its own right.
I have found some web services with APIs that insist upon one format over the other, or that use /
to indicate whether the RESTful resource returns a single item or a list of items; but I cannot find any public-facing websites that follow the current behavior and do not either serve identical content, or redirect to the preferred URL-format (whether that be with, or without a /
).
Even http://laravel.com
currently functions in this way, laravel.com/docs/
produces the documentation as well as laravel.com/docs
does.
It is of course preferable that a single page does not exist at two different addresses, but at the very least it should redirect from one to the other.
from framework.
It's possible to fix this using .htaccess, by rewriting or redirecting to url either with or without trailing slash. It's also possible to enable both variants. Although I agree this should be changed so that na url works with or without /$.
from framework.
Just came across this issue too. Any URL with a trailing slash now returns a NotFoundHttpException since updating to the latest version of L4 this morning.
I'm also of the opinion that Laravel should redirect to one or the other.
from framework.
Related Issues (20)
- Str::apa fails if string is empty HOT 1
- Schedule `between()` not working as expected HOT 4
- [10.x] Conditionable on a Belongs-To-Many query breaks it HOT 4
- memcached socket hang up when using as session handler
- Preventing lazy loading causes problems with eager loaded constraints HOT 1
- `firstOrCreate` not working properly with casts HOT 5
- Memory leak when using Query Builder's chunk method HOT 2
- [11.x] Hidden or Missing .env variables HOT 2
- Documentation for "Squashing Migrations" is not accurate. HOT 1
- [10.x] Process::fake() never matches a multi-line command (or, Str::is() always returns false on multi-line strings) HOT 1
- Blade compilation issues with Tailwind container queries HOT 9
- Undefined property: Illuminate\\Database\\Eloquent\\Relations\\HasMany::$orWhere HOT 4
- [9.x] RateLimiter fails to work when RateLimiter::for uses path as the name instead of const string HOT 1
- Access package configurations using `::` scoped names
- Too few arguments to function __construct() of a class which extends Illuminate\Database\Eloquent\Model and overrides the constructor with a different number of arguments and then also calls parent::_construct HOT 2
- Unit testing failing on multiple database connection
- Migrations not respecting nullable on polygon or point types. HOT 8
- Redis interactions silently fail if using the same connection as a currently subscribed client HOT 1
- Unexpected DateTime Format in assertDatabaseHas Method with Date HOT 1
- Incorrect information in the comment block for the function Str::orderedUuid() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.