开发者

How to hide the name of the file (e.g. "index.html") in a website and work with sections?

I need to create a single-page website using HTML5, which is similar to http://www.20thingsilearned.com

It uses "Sections" in HTML5 as shown below:

http://www.20thingsilearned.com/en-US/web-apps/1

When I create a page index.html with the sections named: foreword, credits, etc ... I can access the page by: http://localhost:2325/index.html and the sections by:

http://localhost:2325/index.html/foreword, unlike the above shown website!! can you please suggest a solution?

further clarification: I开发者_StackOverflow中文版s it possible to do this via JS??


By definition/convention, you can access your page with http://localhost:2325/
If a file isn't specified (which is explicit with the trailing slash), the server provides by default the index.html file.
This default can be changed with the server's settings, I think.

I might have misunderstood the last part, but in general, one accesses the sections with the http://localhost:2325/#forword syntax, instead. The # says to jump to the named section.

Stuff like web-apps/1 is generally handled by a server-side script (PHP, ASP or other) along with rewrite rules, redirecting such URL to a script serving the correct content.


The above can be achieved by using URL rewriting and JS History api.

Since then, I've learnt about URL rewriting and also the usage of route-tables in ASP.NET WebForms 4.

Great link for url rewriting, which mentions the redirect rule for default page as well: syedemad.info/index.php/2012/02/url-rewriting-tips/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜