title: URL Rewrite to FQDN with .netcore 2.2
body: <p>As part of our attempt to start automating our builds/deployments I am trying to figure out how to create a URL Rewrite inside our .netcore 2.2 web app to take rewrite the url from <code>site/</code> to <code>https://sitename.domain.com</code> since currently this is achieved by having the rewrite rule within our web.config on our production server which we do not copy over whenever copying the files over after publishing the project. The web.config on production server has this rule for rewriting.</p>
  
  <pre><code>&lt;rule name="Redirect shortname to FQDN" stopProcessing="true"&gt;
      &lt;match url="^(.*)$" /&gt;
      &lt;conditions&gt;
          &lt;add input="{HTTP_HOST}" pattern="^.*\.domain\.com$" negate="true"/&gt;
      &lt;/conditions&gt;
      &lt;action type="Redirect" url="https://{HTTP_HOST}.domain.com/{R:1}" /&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>I'm trying to achieve the same functionality within the Startup.cs file using the following line inside the Configure method in Startup.cs</p>
  
  <pre><code>app.UseRewriter(new RewriteOptions().AddRewrite("^(?!https://site\\.domain\\.com\\/?(.*))","site.domain.com/$1",false));
  </code></pre>
  
  <p>However this seems does not seem to be working - I'm assuming this is the incorrect way of handling this since I cannot find any information on doing a url rewrite for FQDN with IApplicationBuilder using google.</p>
  
  <p>What would be the correct way to achieve this URL rewrite while moving it out of the web.config or having it be included in the web.config on publish?</p>