Home >Backend Development >PHP Tutorial >Modify and add Apache's default site directory, apache default site directory_PHP tutorial
1. Modify the default site directory of Apache
After the Apache HTTP Server is installed, the default site directory is located in the htdocs folder under its installation directory, and the default homepage is the index.html file in this folder. For example, if my Apache is installed in C:/wamp/bin/apache/Apache2.2.21, then the complete default site directory address of my Apache is C:/wamp/bin/apache/Apache2.2.21/htdocs/. The default homepage is C:/wamp/bin/apache/Apache2.2.21/htdocs/index.html.
Many times, whether we are studying, testing, or actually building our own site, we may not want to put our website in Apache’s default site directory. In this case, the knowledge in this section will help you solve the problem. This question.
Modification method:
1. Go to the conf folder in the installation directory of Apache. There will be a text document such as httpd.conf in this folder. It is the configuration file of Apache and is responsible for directing the operation of Apache.
2. Double-click to open the text document httpd.conf, press the Ctrl F key combination on the keyboard to search for "DocumentRoot "" (with English double quotes", see picture), after finding it (only one place), change the character Change the string in double quotes after the string "DocumentRoot" to the website directory you want to set.
For example: the default is DocumentRoot "C:/wamp/bin/apache/Apache2.2.21/htdocs", now it is changed to DocumentRoot "D:/Apache"
3. After completing the above step 2, do not close the httpd.conf file yet, continue to search, search for " For example: the default is 4. Press the Ctrl S key combination on the keyboard at the same time to save the above modifications. Be sure to stop (STOP) the Apache service once and then start (START) the new modifications to take effect.