How to set default page in Apache?

Apache web server is probably the most used web server across platforms including different Linux distributions and Windows.

The web server is used to deliver web content and can serve many queries at once.

To make the necessary changes you need to modify the DocumentRoot directive of the web server.

This is the directory from which Apache will read the contents that the visitor will access over browser. Or in other words, this is the directory that forms the tree of directories that will be accessible over web.

Apache default page is very easy to configure, we just need to configure Apache conf file.

Step 1: Follow the below path

/etc/httpd/conf/httpd.conf

Step 2: Make the following changes in httpd.conf file.

 Change index.html or index.php to whatever default page you want. 

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Once you’ve modified the document root save the file.

Step 3: Now restart the Apache by using below Command:

(For systemD)
# systemctl restart apache

(For Sysvinit)
# service httpd restart

Was this article helpful?