承接 hafrit/permanent-redirection-bundle 相关项目开发

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

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

hafrit/permanent-redirection-bundle

Composer 安装命令:

composer require hafrit/permanent-redirection-bundle

包简介

A symfony bundle that enable you to create redirections from configuration yml file.

README 文档

README

SensioLabsInsight Total Downloads Latest Stable Version License

This bundle enable you to create infinite number of redirection without using code.

  • User bookmark a page of your site that does't exist anymore so he will have a beautiful 404 page.
  • A link sent into an old mailing campaign and you want to redirect it instead of using controller redirection you can just configure your redirection.

Install

Step 1: Add to composer.json

"require" :  {
    // ...
    "hafrit/permanent-redirection-bundle": "dev-master",
}

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new hafrit\PermanentRedirectionBundle\hafritPermanentRedirectionBundle(),
    );
}

Step 2: imports the bundle services.yml

# app/config/config.yml

imports:
    // ...
    - { resource: '@hafritPermanentRedirectionBundle/Resources/config/services.yml' }

Usage: configure your permanent redirection

# app/config/config.yml

hafrit_permanent_redirection:
    enable: boolean
    redirection_lists:
        - { source: "source_route_name", target: "target_route_name", status: "redirection_status", referenceType: integer, keepParameters: boolean }
        .
        .
        .
        - { source: "source_route_name", target: "target_route_name", status: "301" }
        

Parameters options:

hafrit_permanent_redirection:
    enable: true/false     ~ # Required
    redirection_lists:
        - { 
        source:         ~ # Required                # route name to redirect,
        target:         ~ # Required                # target route name,
        status:         ~ # Required                # redirection status (301, 302, ...) @see Symfony\Component\HttpFoundation\Response.php isRedirect function         
        referenceType:  ~ # Optional Default 1      # @see Symfony\Component\Routing\Generator\UrlGeneratorInterface.php,             
        keepParameters: ~ # Optional Default false  # redirect to target route with the same source route parameters
        }

Example:

hafrit_permanent_redirection:
    enable: true
    redirection_lists:
        - { source: "hello_world", target: "acme_hello_world", status: "301" } 
        # "hello_world" => http://localhost/hello-world will be redirected to http://localhost/acme-hello-world with redirection code 301
        - { source: "hello_with_parameters", target: "acme_hello_with_parameters", status: "302", keepParameters: true }
        # "hello_world" => http://localhost/hello/firstName/lastName will be redirected with the same first and last name to http://localhost/acme-hello/firstName/lastName with redirection code 302

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固