How can I change the index listing in a directory?

You can change the initial page that is sent to client requests when a directory is accessed by placing the following line into your .htaccess file:

DirectoryIndex filename

Replace filename with the actual file you wish displayed when someone visits the directory where your .htaccess file exists. By default, the webserver will display a file named index.html. If that does not exist, then it displays index.htm. If that does not exist, then it displays index.shtml Finally, if that does not exist either it displays index.cgi. If there is not index.cgi file either it lists all of the files in the current directory.
  • 496 Users Found This Useful

Was this answer helpful?

Related Articles

What is a virtual Domain?

A virtual domain is the base URL of the domain name. Examples include yourdomain.com, and...

htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

To solve “.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable” follow...

Redirect http to https and www

To forward a website to use both www. and https:// use the following in an .htaccess file:...

Error 508 / 503 - Resource Limit Reached

To help maintain the stability of servers and keep websites fast, UltraWebHosting has resource...

Disable error_log via htaccess

Prevent public display of PHP errors via htaccess# supress php errorsphp_flag...