承接 knash94/seo 相关项目开发

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

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

knash94/seo

Composer 安装命令:

composer require knash94/seo

包简介

Provides 404 page logging and redirecting for Laravel 5+

README 文档

README

Total Downloads Latest Stable Version License Build Status

A laravel 5 package that adds the ability to log 404 errors and to action these with redirects via a user interface. This has several benefits over creating redirect in a .htaccess (Or your web servers equivalent) as the main laravel application will run and then 404 if a page cannot be found, this is where the package will determine whether there is a redirect available. This prevents scenarios where a redirect may be hit before laravel and limiting access to your application. On top of this, it gives SEO members the ability to track 404 errors, tracking where they have come from and then action them with ease.

Installation

Install the package with composer

composer require knash94\seo

Once installed, add the following line into your config/app.php service providers

'Knash94\Seo\SeoServiceProvider'

Then open your \App\Exceptions\Handler.php file and insert the following code under the render method, be sure not to change any existing code on the method

$redirect = $this->reportNotFound($exception);

if ($redirect && $redirect instanceof RedirectResponse) {
    return $redirect;
}

Also add the LogsMissingPages trait to \App\Exceptions\Handler.php

use LogsMissingPages;

Also import the Illuminate\Http\RedirectResponse; in App\Exceptions\Handler.php

Finally, publish the vendor files and run the migrations by running these commands

php artisan vendor:publish --provider=Knash94\Seo\SeoServiceProvider
php artisan migrate

Configuration

There are various configuration options to choose from, I'd recommend setting the middleware, template and section values. Simply open seo-tools.php and set the new values. Below is an example setup using your own template

<?php

return [
    'routing' => [
        'prefix' => 'admin/seo-tools',
        'namespace' => 'Knash94\Seo\Http\Controllers',
        'middleware' => ['auth']
    ],

    'views' => [
        'template' => 'layout.admin',
        'section' => 'content',
        'index' => 'seo-tools::bootstrap3.index',

        'errors' => [
                    'edit' => 'seo-tools::bootstrap3.errors.edit',
                    'view' => 'seo-tools::bootstrap3.errors.view'
                ],
        
                'redirects' => [
                    'edit' => 'seo-tools::bootstrap3.redirects.edit',
                    'delete' => 'seo-tools::bootstrap3.redirects.delete'
                ]
        ],
        
        // Filters what URLs to not record using regex
        'filters' => [
            '/(\.png)|(\.jpg)|(\.gif)/',
            '/wp\-login\.php/'
        ]
];

If you want to link the redirect manager into your admin panel, then create a link to the seo-tools.index route

Todo

  • Testing suite
  • Ability to test if a redirect works as intended before applying the change
  • To mass insert redirects
  • Ability to add regex into redirects

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固