Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 configure one specific directory on my webserver to use an atypical default file such as "default.php" instead of "index.php"? Do I have to create a ".htaccess" file in that dir?

share|improve this question
up vote 7 down vote accepted

Yep, put the following in a .htaccess file:

DirectoryIndex default.php

And that will apply to that directory, and I think all subdirectories.

This assumes you're using Apache; other webservers may have other conventions.

share|improve this answer
How do I set it not to apply to subdirectories? – Jarvis Jul 8 '09 at 11:13
You don't, as far as I know. You need to put in separate .htaccess files for the subdirectories. – womble Jul 9 '09 at 2:42

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.