mrssoft/yii2-url-redirect 问题修复 & 功能扩展

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

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

mrssoft/yii2-url-redirect

Composer 安装命令:

composer require mrssoft/yii2-url-redirect

包简介

Extension for redirection from old url to new one

README 文档

README

Extension for redirection from old url to new one.

Configure

Add to config:

    'components' => [
        ...
        'redirect' => [
            'class' => 'mrssoft\redirect\UrlRedirect',
            'tableName' => '{{%redirect}}', // Table name
            'db' => 'db', // DB connection component
            'code' => 302, // Redirect status code
        ],
        'response' => [
            'as urlRedirect' => [
                'class' => 'mrssoft\redirect\UrlBehavior',
                'redirect' => 'redirect' // UrlRedirect component
            ]
        ],
        ...
    ]

Add the table to the database:

    CREATE TABLE `redirect` (
        `old_url` VARCHAR(255) NOT NULL,
        `new_url` VARCHAR(255) NOT NULL,
        `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (`old_url`)
    )
    ENGINE=InnoDB

Usage

Add a link to the redirect database:

    Yii::$app->redirect->add('/old/url/', '/new/url');

Clear old links:

    Yii::$app->redirect->clear('-3 month');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固