2014-03-03 31 views
2

I have tried googling but all of the links I find are about linking resources, for example images with ../, Might be an easy question to solve - but internet searches aren't helpful...<a href=""> root of folder rather than index.html

Say I have the folder "html" of which my webserver would use as the root, within that folder is index.html, page.html and page2.html, when linking something I'd usually do: <a href="index.html">Home</a> but is there a way to link the root, so you get demos/ rather than demos/index.html.

+2

您是否嘗試過'HREF =「/」'根的符號? –

+0

@ŠimeVidas是的,它將它發送回根文件夾,而不是Web服務器的根目錄 – user3352340

回答

3

./是對當前文件夾

0

Use

<a href="../abc.html">Back to Fruits List</a> 

.. Goes to root ,and you can fetch any page after that.

0

You have to disable the "default" page (such as index.html) on you webserver configuration to see the contents of the directory, but this will expose you site structure which is not a good idea for security reasons.

0

If you are using Apache HTTP server you can create a file called .htaccess in the demos folder (/demos/.htaccess) and write the following in it.

DirectoryIndex index.html 

That way when you visit http://example.com/demos/它會顯示的index.html

相關問題