Giter Club home page Giter Club logo

episerver-redirect-manager's Introduction

Redirect Manager

Build Status

Redirect Manager is an Episerver CMS helper utility to define url redirections and manage them with a graphical user interface Redirect Manager menu is available at CMS section for defined roles Image of Yaktocat

Solita.RedirectManager.TestProject is a sample project to demonstrate how to use Redirect Manager. Image of Yaktocat

To allow specific roles for access define a location set authorization at web.config file

<location path="EPiServer/Solita.RedirectManager">
    <system.web>
        <authorization>
            <allow roles="WebAdmins, Administrators" />
            <deny users="*" />
        </authorization>
    </system.web>
</location>

Features

  • Add/Remove redirection rules
  • Wildcard pattern matching
  • Import redirection rules from CVS file
  • Display specific rule's last match datetime

How it works:

Configure your site to route HTTP 404 errors

<httpErrors errorMode="Custom">
    <remove statusCode="404" />
    <error statusCode="404" path="/error/http404" responseMode="ExecuteURL" />
</httpErrors>

At handler apply redirect rules

 public class HttpErrorPageController : Controller
    {
        [Route("error/http404")]
        public ActionResult Http404()
        {
            var rewritemapService = ServiceLocator.Current.GetInstance<RewritemapService>();

            var originalUrl = IisErrorUrlParser.GetOriginalUrl(System.Web.HttpContext.Current.Request.Url, 404);
            var redirectTo = rewritemapService.FindRedirectUrl(originalUrl.Host, originalUrl.PathAndQuery, true);
            if (redirectTo != null)
            {
                return RedirectPermanent(redirectTo);
            }
            Response.Clear();
            Response.StatusCode = (int) HttpStatusCode.NotFound;
            return Content("404 Not found");
        }
    }

Further development

  • Build solution using configuration DevDeploy
    • DevDeploy configuration packages Solita.RedirectManager project
    • Copies the required build artifacts to Solita.RedirectManager.TestProject project
    • This way changes in the redirect manager project are available immediatelly in the test project after build

Tests

All unit tests should be green. Otherwise there is something wrong with core functionalities

Build targets

Custom build targets are defined in Solita.RedirectManager.csproj file(in the end). The custom build targets are activated only if "DevDeploy" configuration is selected

episerver-redirect-manager's People

Contributors

solita-yusuftiryaki avatar maxmakisalo avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar Mikko Huilaja avatar Jari Haapatalo avatar Sami Leinonen avatar Joona Immonen avatar  avatar  avatar

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.