aurawindsurfing/slashremovemiddleware 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aurawindsurfing/slashremovemiddleware

最新稳定版本:v1.0.4

Composer 安装命令:

composer require aurawindsurfing/slashremovemiddleware

包简介

This package adds 301 redirect to all routes with trailing slashes.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

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:

Route::get('/foobar', function () {
    return 'simple test';
});

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

composer require aurawindsurfing/slashremovemiddleware

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

composer test

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

License

license. Please see the license file for more information.

统计信息

  • 总下载量: 37
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-22