Coder Social home page Coder Social logo

ronaldbarendse / skybrud.umbraco.redirects Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skybrud/skybrud.umbraco.redirects

0.0 0.0 0.0 1.75 MB

Redirects manager for Umbraco 7.

License: MIT License

JavaScript 20.99% CSS 9.69% HTML 21.09% C# 48.23%

skybrud.umbraco.redirects's Introduction

Skybrud.Umbraco.Redirects

This package features a dashboard and property editor that let's users manage inbound redirects from within the Umbraco backoffice.

URLs can be added to redirect to either a content item, media item or a custom URL.

image

Installation

  1. NuGet Package
    Install this NuGet package in your Visual Studio project. Makes updating easy.

  2. ZIP file
    Grab a ZIP file of the latest release; unzip and move the contents to the root directory of your web application.

Features

  • Global dashboard for listing all redirects. Supports filtering and searching.

  • Property editor that can be added to either a content item or media item to show inbound redirects

  • Package only handles custom redirecs - eg. added manually by an editor. The will let Umbraco 7.5+ handle redirects for renamed pages

  • Includes a RedirectsRepository for managing the redirects from your own code

Configuration

Adding the HTTP module to Web.config

In order to handle the redirects, this package comes with a HTTP module - which for now must be added manuelly to Web.config. In your Web.config, search for the <system.webServer> element. Then add the following to the <modules> child element.

<remove name="RedirectsHttpModule" />
<add name="RedirectsHttpModule" type="Skybrud.Umbraco.Redirects.Routing.RedirectsHttpModule, Skybrud.Umbraco.Redirects" />

The order shouldn't matter that much, but we typically add it right after:

<remove name="UmbracoModule" />
<add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />

In a standard Umbraco 7.5, the entire <modules> element would then look like:

<modules runAllManagedModulesForAllRequests="true">
	<remove name="WebDAVModule" />

	<remove name="UrlRewriteModule" />
	<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

	<remove name="UmbracoModule" />
	<add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />

	<remove name="RedirectsHttpModule" />
	<add name="RedirectsHttpModule" type="Skybrud.Umbraco.Redirects.Routing.RedirectsHttpModule, Skybrud.Umbraco.Redirects" />

	<remove name="ScriptModule" />
	<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

	<remove name="ClientDependencyModule" />
	<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" />

	<!-- Needed for login/membership to work on homepage (as per http://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests) -->
	<remove name="FormsAuthentication" />
	<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
	<add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" />
</modules>

Adding a Redirects tab to the Content dashboard

This step is optional, but if you wish to show redirects at a global level, you can add a Redirects tab to the dashboard of the Content section. To do this, open up ~/Config/Dashboard.config, and search for the line with <section alias="StartupDashboardSection">. This particular <section> element describes the tabs of the Content section. THe Redirects tab can be added by adding the following XML as a child element:

<tab caption="Redirects">
	<access>
		<grant>admin</grant>
	</access>
	<control showOnce="true" addPanel="true" panelCaption="">/App_Plugins/Skybrud.Umbraco.Redirects/Views/Dashboard.html</control>
</tab>

With the example above, the tab will only be visible to admins. If you remove the <access> element, all your users will be able to see the tab.

The dashboard will list all redirects - for content, media and custom URLs.

Screenshots

Besides the dashboard shown in the top of this page, the package also features property editor that let's users add new inbound redirect directly from the content or media item being editied.

For instance the screenshot below illustrates the property editor added to a content type:

image

Or the same property editor added to a media type - eg. here added to the Image media type:

image

Under the hood

The package comes with a HTTP module that will kick in when Umbraco or IIS returns a response with a 404 status code. If this is the case, the module will look up the requested URL, and then redirect the user if a matching redirect is found in the database.

skybrud.umbraco.redirects's People

Contributors

abjerner avatar skttl avatar rasmusfjord avatar mastrup 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.