How do I change default directory and index file f

2019-06-20 08:44发布

How do I change default Directory and index File for Apache (installed via XAMPP) so instead of looking for htdocs and index, it looks for myPath and myFile, respectively?

2条回答
我想做一个坏孩纸
2楼-- · 2019-06-20 09:04

Edit the httpd.conf file - the DocumentRoot directory can be updated to whichever directory you would like (and that the process has permissions to). See:

http://httpd.apache.org/docs/2.0/mod/core.html#documentroot

DocumentRoot /usr/web 
查看更多
SAY GOODBYE
3楼-- · 2019-06-20 09:07

The research link you pasted has the first part of the answer to your question, changing the path you want serve but the second part of your question, making it serve "myFile" as the Index is an additional step. See:

http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex

So you would add this line inside the relevant tags or even loose in the main httpd.conf file (see the Context section of the above link for valid places to use this directive):

DirectoryIndex myFile.ext

Hope this helps.

查看更多
登录 后发表回答