Amal Antony
Amal Antony

Reputation: 6787

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? Which file will I find the setting to do this? Thanks!

Upvotes: 4

Views: 12578

Answers (2)

Álvaro González
Álvaro González

Reputation: 146350

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.

Upvotes: 0

David Hancock
David Hancock

Reputation: 14991

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.

Upvotes: 5

Related Questions