0

I have a file called "index.html" that I don't want to convert to a View in my project. When I browse to this file, I see:

"mydomain.com/index.html"

in the browser's address window, but I would instead just like to see:

"mydomain.com"

How can I accomplish this in an ASP.NET MVC project?

flying227
  • 1,231
  • 3
  • 22
  • 36

2 Answers2

1

If you are navigating to it you can link to the root of your site "/" or "mydomain.com" instead of "index.html". Example:

Instead of this:

<a href="/index.html">Some Page</a>

Do this:

<a href="mydomain.com">Some Pag</a> 

Just a suggestion but I would just convert the file to a view so you can take advantage of the framework as well as things like routing to display the url how you want.

Stephen Brickner
  • 2,584
  • 1
  • 11
  • 19
  • 3
    It's important to note that this works only because "index.html" is typically set up as a default page in web servers. However, that's not always the case and can be changed. – Chris Pratt Jul 29 '15 at 18:58
0

You can modify the url after the page has loaded with javascript:

window.history.pushState("yada", "Title", "/mydomain.com");

See this and this

Community
  • 1
  • 1
brroshan
  • 1,640
  • 17
  • 19