Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I just get a definitive answer from you guys.

If I have a file called index.php in a folder called about should I link using a trailing slash for example:

<a href="/about/"></a>


<a href="/about"></a>

Finally, one of my clients using IE9 is saying that certain links are not opening, I've tried with an without the slash.

Is there anything I could add to my .htaccess to sort this out?

I've tested the page in question and it seems fine for me but you know what clients are like, he wants it working on his PC.

share|improve this question
Sorry my code snippets got stripped out, you know what I mean anyway I'm sure. – Richard Dale Jan 2 '13 at 14:34

When a web server receives a request ending in a / it will serve the default page as in the configuration or default.

You can configure this in an .htaccess file or in the core config for Apache, using the DirectoryIndex directive.

There is also a directive DirectorySlash that specifies whether to serve the index file when requesting a directory name. If you turn this off then you may see an autoindex page instead. Apache recommend that you don't turn this off without a good reason.

To be on the safe side, always include the trailing / or link specifically to the intended index file for the directory.

If you are using a different web server, please update your question.

share|improve this answer
Hi thanks very much for replying. I am using Apache on a Linux server. I've added the slash now. My client can access every page on the site apart from this can you think of any reason why this could be? – Richard Dale Jan 2 '13 at 16:20
I've decided to use DirectoryIndex index.php, to see if this solves the issue. Could this be added to the htaccess file in the root of the site to force index.php to be the default for all folders? – Richard Dale Jan 2 '13 at 18:11
Yes - in the Apache documentation the Context line for each directive shows where you can use it. In this case you can use it in the main section of the config file, within a Virtual Host or Directory config, or in an .htaccess file. – dunxd Jan 3 '13 at 9:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.