The URL management module automatically tracks not found (404) responses and lets you set redirects to internal pages or external URLs.
Installation
The URL management module consists of 2 components: a package containing the middleware to include in your web project, and a separate package containing the back office components to include in your back office project. If you have a single project for both web publication and back office, you include both packages in that project.
In your web project, install the URL management web package with the NuGet package manager or the Package Manager Console.
PM> Install-Package Redakt.UrlManagement.Web
In your back office project, install the URL management back office package with the NuGet package manager or the Package Manager Console.
PM> Install-Package Redakt.UrlManagement.BackOffice
Service registration
Services for the Url Management module are registered automatically by the default services.AddRedakt()
call, so you don't have to register this module explicitly. Alternatively, if you prefer to register modules manually, you can do so by calling services.AddRedakt(false)
instead to prevent automatic module registration. In that case, you have to register the module explicitly as follows.
Register URL management services in the ConfigureServices()
method in your project's Startup.cs
file by adding an AddUrlManagement()
call to the Redakt builder instance. The order in which services are added to the Redakt builder is not important. If you have separate web publication and back office projects, you need to register URL management services in both projects.
public void ConfigureServices(IServiceCollection services)
{
// ... framework and other services here
var builder = services.AddRedakt(false); // Pass false to prevent automatic registration of installed Redakt modules.
builder.AddUrlManagement();
// ... other Redakt services
}
Configuration settings
The URL management module does not require configuration.
Middleware registration
The URL management module requires its middleware to be inserted into the ASP.NET Core request pipeline in your web project (not your back office project if it is a different one). Add the middleware to the request pipeline in the Configure()
method of your project's Startup.cs
file. The code snippet below shows the correct order in which to add Redakt middleware when you're also including other Redakt middleware in this project.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// ... other pipeline configuration here
// Register Url management first
app.UseRedaktUrlManagement();
// Other Redakt middleware registration
app.UseRedaktIdentityServer();
app.UseRedaktBackOffice();
app.UseRedaktPageRendering();
}