/RedirectManager

Simple and portable redirect manager for Episerver websites

Primary LanguageC#

Redirect Manager

Redirect Manager is simple, portable, extendable, open source redirect tool for Episerver projects.

Description

It's built to be as minimalistic as possible and as an example of simple Episerver add-on. It requires only 7 files for business logic and data access, 2 controllers and 1 view.

New 2.0 version has a bit smaller appearance and multi-site support

Preview:

Features

  • Easily create redirects to any URLs or to Episerver pages.
  • Wild card rules.
  • Reordering and prioritizing rules.
  • Multi-site support.
  • Allow moving and changing URLs of Episerver pages and the redirects still works.
  • All redirects are HTTP 301 (Moved permanently), because search engines only follow this kind of redirects.
  • Access restrictions allow usage of rule manager to only administrators.
  • And the most important: It's open Source and it's yours to extend and manipulate! Solita <3 Open Source!

The key features actually are what this add-on is NOT

  • No CSS or styling;
    There isn't even a single line of CSS or styling in project. Frameworks as Bootstrap give enough styles for simple solutions and it's responsive OOTB.
  • No NuGet packaging;
    It's not a NuGet package because NuGet packages aren't agile enough. It's easier to copy&paste changes.
  • No DDS;
    We have come to conclusion that Dynamic Data Storage isn't scalable and functional for our purposes.
  • No Dojo Toolkit, No Dijit;
    Dojo framework is way too large and complicated framework for simple solutions like this.
  • No extra controllers and models;
    MVC is nice concept, but controllers and models are often not important. Coding some trivial logic to views will your project more agile.
  • No REST;
    Normally we would have used AngularJS and Web API, but with administration tools it's not necessary.
  • No Translations;
    Administers normally do not need localizations, so why waste of time and energy.
  • No Unit Tests;
    There is no point of testing trivial things and unit testing != no bugs.

Redirection rules

Here's couple of examples what kind of rules are possible.

Minimum Requirements

  • Episerver 7 MVC project with C#7
  • Entity Framework

Installation instructions

  1. Install Entity Framework from NuGet.
    https://www.nuget.org/packages/EntityFramework
  2. Copy files into your project
  3. Add .MapMvcAttributeRoutes() to RegisterRoutes override in Global.asax.cs
  4. Apply manually Web.Config transformations
  5. Go to www.yourproject.com/Admin/RedirectManager

Instructions for usage

File structuce

Basic 404 redirect logic

Auto wire up

You can automatically populate the RedirectManager with data on following events from editors, moving pages in structure, renaming url segment and deleting from Waste Basket. Just put this in your InitializableModule:

var events = ServiceLocator.Current.GetInstance<ContentEvents>();
            events.MovingContent += RedirectKeeper.Page_Moving;
            events.PublishingContent += RedirectKeeper.UrlSegment_Changed;
            events.DeletedContent += RedirectKeeper.Page_Deleted;