Skip to content Skip to sidebar Skip to footer

Default File For Apache Localhost

I have apache2 installed. When i type http://localhost it goes to a file http://localhost/class/index.php . How do i change it to say http://localhost/index.html or any other page?

Solution 1:

Find the DirectoryIndex directive in your Apache configuration file (httpd.conf) or add it to a .htaccess file and change it to look like this if you want to limit your default index file to just index.html:

DirectoryIndex index.html

You can also include more resources and they will be used in the order given, e.g

DirectoryIndex index.html index.php

would display the index.html file first if both index.html and index.php existed.

Don't forget to restart Apache if you made the change to the httpd.conf file.

Look at the mod_dir documentation for more information.

Solution 2:

Apache will not trigger HTTP redirections unless you instruct it to do so.

My advice is that you open your favourite text editor and search for the class string in the following locations:

  • *.conf files inside the Apache installation directory.
  • .htaccess files inside your HTML directores.

If that fails to find anything, you could also search for header() calls in your *.php code.

Post a Comment for "Default File For Apache Localhost"