URL Manipulation
The Netflex Toolbox has some features that can help you deal with the wierd trailing slash behavior of the old framework, when working on migrated pages.
We have added two middlewares that can either help you ensure you don't have trailing slashes, or add them if you so see fit.
Adding Slashes
To ensure all urls have slashes, we have a middleware called add-slash
, which can be used to redirect all GET
requests that does not end with a slash, that will redirect them to the same url but with a trailing slash.
This middleware has an adjustable status code, that can be added like this; add-slash:307
.
We also have an URLGenerator that ensures all urls generated by laravel has a trailing slash. You can extend the existing URLGenerator with this one to keep your current functionality, but still ensure trailing slash.
Removing slashes
Just like when adding slashes, we have a similar middleware called remove-slash
which removes trailing slashes from urls. This middleware can also have its status code adjusted like this; remove-slash:307
.
Since Netflex ignores the slash internally and laravel does not append slashes by default, you dont need to adjust the URL Generator.