Search Results for

    Show / Hide Table of Contents
    View Source

    Class RedirectTrackingHandler

    Handles notifications to manage tracking of redirect URLs when content is renamed or moved. When content is renamed or moved, this handler creates a permanent 301 redirect from its old URL to the new one.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Routing
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public sealed class RedirectTrackingHandler : INotificationHandler<ContentPublishingNotification>, INotificationHandler<ContentPublishedNotification>, INotificationHandler<ContentMovingNotification>, INotificationHandler<ContentMovedNotification>, INotificationHandler
    Remarks

    Domain changes are not managed by this handler; changing domains requires a higher-level strategy, such as using URL rewriting rules. Moving content to or from the recycle bin does not create redirects, as the node is either removed or restored without a meaningful previous URL.

    Constructors

    View Source

    RedirectTrackingHandler(IOptionsMonitor<WebRoutingSettings>, IRedirectTracker)

    Initializes a new instance of the RedirectTrackingHandler class.

    Declaration
    public RedirectTrackingHandler(IOptionsMonitor<WebRoutingSettings> webRoutingSettings, IRedirectTracker redirectTracker)
    Parameters
    Type Name Description
    IOptionsMonitor<WebRoutingSettings> webRoutingSettings

    An Microsoft.Extensions.Options.IOptionsMonitor<TOptions> for WebRoutingSettings that provides access to the current web routing configuration.

    IRedirectTracker redirectTracker

    An IRedirectTracker instance used to track and manage redirects.

    Methods

    View Source

    Handle(ContentMovedNotification)

    Handles a ContentMovedNotification by creating redirect entries for the old URLs of the moved content. This ensures that requests to previous URLs are redirected to the new locations.

    Declaration
    public void Handle(ContentMovedNotification notification)
    Parameters
    Type Name Description
    ContentMovedNotification notification

    The notification containing details about the moved content items.

    View Source

    Handle(ContentMovingNotification)

    Handles the content moved notification by creating redirects for old routes when content is moved.

    Declaration
    public void Handle(ContentMovingNotification notification)
    Parameters
    Type Name Description
    ContentMovingNotification notification

    The notification containing information about the moved content.

    View Source

    Handle(ContentPublishedNotification)

    Handles a ContentPublishedNotification to track and manage redirects when content is published.

    Declaration
    public void Handle(ContentPublishedNotification notification)
    Parameters
    Type Name Description
    ContentPublishedNotification notification

    The notification containing information about the published content.

    View Source

    Handle(ContentPublishingNotification)

    Handles the content moved notification to create redirects for old routes when content is moved.

    Declaration
    public void Handle(ContentPublishingNotification notification)
    Parameters
    Type Name Description
    ContentPublishingNotification notification

    The content moved notification.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX