user3352340
user3352340

Reputation: 145

<a href=""> root of folder rather than index.html

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...

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.

Upvotes: 4

Views: 3136

Answers (4)

Alex
Alex

Reputation: 7374

./ is the notation for the root of the current folder

Upvotes: 6

scootergrisen
scootergrisen

Reputation: 1031

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/ it will show the index.html

Upvotes: 0

Leo
Leo

Reputation: 6570

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.

Upvotes: 0

Pratik Joshi
Pratik Joshi

Reputation: 11693

Use

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

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

Upvotes: 1

Related Questions