承接 watson/canonical 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

watson/canonical

最新稳定版本:1.0.0

Composer 安装命令:

composer require watson/canonical

包简介

Canonical host middleware for Laravel

README 文档

README

Need your Laravel app to redirect from the root domain to www. or the other way around? Need your Laravel app to redirect all visitors to a HTTPS connection?

This is a small library for Laravel that provides a simple middleware that provides basic redirects for Laravel apps. You simply set the canonical host for your app and whether you want requests to be secured by default and Canonical will handle the rest.

This prevents duplicate content by ensuring that all visitors to your site are redirected to the correct host and upgraded to a secure connection if available.

You can configure this sort of stuff up in your web server as well, but there is an ease to keeping it inside your app so it's all kept in the same place.

Installation

First run composer require watson/canonical.

Next, add Watson\Canonical\CanonicalMiddleware to your app/Http/Kernel.php file where you'd like it to run.

Please note that Canonical only supports Laravel 5.5 at this time.

Configuration

You can configure Canonical through environment variables or by publishing the configuration file to your app with php artisan vendor:publish --tags=config.

Take a look at the configuration file that was created for you, config/canonical.php. Here you can set the default host name that you want to use for your app.

If your app receives a request from another host it will perform a permanent redirect to the canonical host you've set here, keeping the request path.

You can also opt to secure all requests too, so an insecure request will automatically be redirects to HTTPS if your site supports it.

Finally you are able to opt-out certain hosts if you don't want to redirect them - for example, an api. subdomain. Add any domains you wish to the ignore array.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固