Git Product home page Git Product logo

craft-redirector's Introduction

Redirector

A Craft CMS plugin for handling legacy paths and URLs by preventing 404s and redirecting to the new entry's URL.

Contents

Usage

In order to handle legacy paths and URLs, we need to create a field to capture them. We can make use of Craft's built-in URL field for this purpose.

  1. Create a new field of type URL. Set the Allowed URL Types to Web Page.

  2. Add this field to all sections where entries have URLs of their own.

  3. Create a config file for this plugin config/redirector.php and add the handle of the field created in the first step.

    <?php
    
    return [
      'redirectField' => 'legacyUrl',
    ];

Installation

You can install this plugin with Composer.

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/project

# tell composer to use the plugin
composer require miranj/craft-redirector:dev-dev

# tell Craft to install the plugin
./craft plugin/install redirector

Requirements

This plugin requires Craft CMS 3 or 4.


Brought to you by Miranj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.