title: Difference between UseHttpsRedirection and AddDirectToHttpsPermanent in ASP.NET Core
body: <p>In the <code>Startup.cs</code> file, consider the following:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      // Irrelevant code removed
  
      services.AddHttpsRedirection(options =&gt;
      {
          options.RedirectStatusCode = StatusCodes.Status301MovedPermanently;
      });
  }
  
  // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      // Irrelevant code removed
  
      app.UseHttpsRedirection();
  
      app.UseRewriter(new RewriteOptions()
          .AddRedirectToWwwPermanent()
          .AddRedirectToHttpsPermanent()
      );
  }
  </code></pre>
  
  <p>As far as I know, I have to use the Rewriter to set the <code>AddRedirectToWwwPermanent</code>. My question is, should I be using both <code>app.UseHttpsRedirection()</code> and <code>AddRedirectToHttpsPermanent()</code>? Or if they doing the exact same thing, which should I remove? </p>
  
  <p>I just want to make sure I'm redirecting to Https properly, in conjunction with the Wwww redirect.</p>