Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Handle redirection to simple URL format

Fixed in

EPiServer.CMS.Core 12.7.0

(Or a related package)

Created

Mar 21, 2022

Updated

Jun 21, 2022

Area

CMS Core

State

Closed, Acceptance tests pass


Description

Currently, CMS pages with a simple URL have two page URLs: the full page URL and the simple URL. If simple URL format is preferred (RoutingOptions.PreferredUrlFormat = PreferredUrlFormat.Simple), then generated URLs will be in simple format. However, the full page URL is still accessible.

Ideally a request to the full page URL will result in a temporary redirect (HTTP 302 Found) to the simple URL, and this redirection behavior could be configurable.

Configuration

In Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    // omitted for brevity

    services.Configure<RoutingOptions>(o => o.PreferredUrlFormatRedirection = HttpRedirect.Permanent);
}

There are three possible values for HttpRedirect:

  • None
  • Temporary
  • Permanent

You also can set through appsettings.json.