/// <summary> /// Redirect a request to the specified host / domain if the current host is different. /// </summary> /// <param name="options">The rewrite options.</param> /// <param name="host">The canonical host (eg. "domain.com").</param> public static RewriteOptions AddRedirectToCanonicalHost(this RewriteOptions options, string host) => options.AddRedirectToCanonicalHost(host, StatusCodes.Status302Found);
/// <summary> /// Redirect a request to the specified host / domain if the current host is different, /// with returning a 301 status code for permanently redirected. /// </summary> /// <param name="options">The rewrite options.</param> /// <param name="host">The canonical host (eg. "domain.com").</param> public static RewriteOptions AddRedirectToCanonicalHostPermanent(this RewriteOptions options, string host) => options.AddRedirectToCanonicalHost(host, StatusCodes.Status301MovedPermanently);