Default file for Apache localhost

自古美人都是妖i 提交于 2019-12-10 16:47:44

问题


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!


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/6874480/default-file-for-apache-localhost

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!