定制 jord-jd/seo-middleware 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jord-jd/seo-middleware

最新稳定版本:v3.0.0

Composer 安装命令:

composer require jord-jd/seo-middleware

包简介

SEO Middleware - middleware to redirect to HTTPS when in production, and remove www. from URLs

README 文档

README

This package contains various middleware classes that can be uses with Laravel 5.1 and above to easily add various SEO benefits to your site / web application.

Features

  • Redirecting production HTTP requests to HTTPS
  • Removal of www. from requests and redirecting
  • Middleware classes can be applied global or to specific routes

Quick Start

  1. Run composer require jord-jd/seo-middleware.
  2. In the $middleware array in your app/Http/Kernel.php file:
  • For HTTP to HTTPS redirects, add \JordJD\SeoMiddleware\Http\Middleware\HttpsOnly::class.
  • For removal of www. from requests, add \JordJD\SeoMiddleware\Http\Middleware\RemoveWww::class.
  1. Remember to set the APP_ENV variable to prod (in the project's .env file) when the application is running in production. Some middleware will only function when this is set to allow for easier local development.

Available Middleware Classes

Any of these middleware classes can be used globally, by adding them to the $middleware array in apps/Http/Kernel.php file. They can also be used on a per route basis, by adding them to the $routeMiddleware array in the same file and then associated them with a route in your apps/Http/routes.php file.

HttpsOnly Middleware

The HttpsOnly middleware will redirect any HTTP request to their HTTPS equivalents. The security of websites is becoming an ever increasing ranking signal for search engine rankings.

The HTTP to HTTPS redirect will only take place if the application environment is set to prod (production), to aid with local development environments in the setup of HTTPS can be difficult and in many cases unnecessary. Changing this setting can be set in your project's .env file, as shown in the example extracts below.

APP_ENV=local # Local development (redirect disabled)
APP_ENV=prod  # Production use (redirect enabled)

RemoveWww Middleware

The RemoveWww middleware will check for www. within the URL of any requests made to your web application and then redirect them to a version of the URL without the www. removed. This can be beneficial for SEO purposes by the potential for similar URLs to be indexed with the same content.

This redirect will occur regardless of the application environment (APP_ENV) setting.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2026-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固