1

Is there are any way to remove # in URL of .NET Core project? My project is using app.UseFileServer() to serve react application (production/build from react app) inside wwwroot. It is working properly if only we acess the root URL of .NET Core that serves using IIS, for example:

https://yourdomain.com

But if we want to go to the route of react for example route about, it needs a URL like this:

https://yourdomain.com/#/about

I don't know why the # sign should be there, is there are any way to make the URL like this:

https://yourdomain.com/about

so it directly accesses the route about of react?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • 1
    _"I dont know why the # sign should be there"_ - because everything after the `#` is called the fragment, and that doesn't get sent to the server. If it does, it's part of the path. Either configure all paths except a (directory) whitelist (for static resources) to your index.html, or leave it that way? – CodeCaster Feb 10 '20 at 10:50

1 Answers1

0

You are using hashHistory routing in react app. In the case if you want to remove # please use browserHistory routing for more detail check this
https://stackoverflow.com/a/35185338/7327166

debug_dk
  • 100
  • 1
  • 5
  • Thanks for your answer, but actually it serves properly without # if I serve using node js with command of npm start. – arga wirawan Feb 10 '20 at 12:53