title: .NET Core - Set custom route URL for the controllers
body: <p>Scenario -
  Instead of controllers being routed to the</p>
  <pre><code>localhost:5555/home/menu
  </code></pre>
  <p>(<em>home ==&gt; HomeController and menu ==&gt; action</em>),</p>
  <p>I wanted to route the APIs to something like</p>
  <pre><code>localhost:5555/abc/xyz/mnop/ert/home/menu
  </code></pre>
  <p>I used</p>
  <pre><code>app.UsePathBase(new PathString(&quot;/abc/xyz/mnop/ert&quot;));
  app.UseRouting();
  </code></pre>
  <p>But the API responds 200 on both <code>localhost:5555/home/menu</code> and <code>localhost:5555/abc/xyz/mnop/ert/home/menu</code>. <strong>However</strong>, it should have responded 200 on <code>localhost:5555/abc/xyz/mnop/ert/home/menu</code> and 404 on <code>localhost:5555/home/menu</code>.</p>
  <p>Surfed and found out that there was an issue <a href="https://github.com/dotnet/aspnetcore/issues/2698" rel="nofollow noreferrer">UsePathBase does not disable root path</a> reported and closed without a concrete response.</p>
  <p>I don't want to implement any custom middleware as it will impact the performance of the application. Is there any alternative approach?</p>