Download the PHP package aurawindsurfing/slashremovemiddleware without Composer
On this page you can find all versions of the php package aurawindsurfing/slashremovemiddleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aurawindsurfing/slashremovemiddleware
More information about aurawindsurfing/slashremovemiddleware
Files in aurawindsurfing/slashremovemiddleware
Package slashremovemiddleware
Short Description This package adds 301 redirect to all routes with trailing slashes.
License MIT
Homepage https://github.com/aurawindsurfing/slashremovemiddleware
Informations about the package slashremovemiddleware
SlashRemoveMiddleware
It is important to remove trailing slashed from applications made with laravel and it is bad for SEO as Google will index your page twice, once with slash and once without it. The correct behaviour is to create 301 for ever page with trailing slash to avoid content duplication in search results.
Here is the source: https://developers.google.com/search/blog/2010/04/to-slash-or-not-to-slash
Before you start
An easy way to check if your app is behaving properly is to create a test route in routes/web.php
like this:
Then visit this endpoint with trailing slash yourapp.test/foobar/
If "simple test" was displayed and trailing slash did not dissapear from your url in the browser window then Google will not be happy about it and you need to fix it.
Installation
Via Composer
Usage
This package will auto register itself in Laravel 6 and higher.
Now repeat the same test.
You should be redirected to the same url but without trailing slash yourapp.test/foobar
and see the same text.
Now Google will only index every page once.
Change log
Please see the changelog for more information on what has changed recently.
Testing
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
- Tomasz Lotocki
- All Contributors
License
license. Please see the license file for more information.