What is the role of DirectoryIndex in .htaccess file

Whenever you enter a URL in the browser, that URL is pointing to a specific file on the web server. For the main parent domain every web server has default page settings. For example if i type www.programmingbaba.com the default page will be index.php. So typing www.programmingbaba.com or www.programmingbaba.com/index.php will open the same page.

There are some default conventions which usually each web servers know these days. For example if your home page is index.php or index.html. You don’t need to do any settings to tell the server that these are my default home pages. If you want to customize your default page or if your server is not configured or if you are getting the following kind of response when you open your main domain

directoryindex in .htaccess file

directoryindex in .htaccess file

and you want to set yourself a default page for your website. You can use DirectoryIndex tag in your .htaccess file to configure your default pages.

Simply add the following line in your .htaccess file


simple keep on adding all default pages which you want to configure.

Sana Beginner Programmer Asked on September 16, 2014 in General Question.
Add Comment
0 Answer(s)

Your Answer

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