Mod\_dir module, by default, gets installed alongside Apache’s installation. This module helps Apache to choose an index file if any URL doesn’t have a specific file path.
Here’s how to configure mod\_dir in the Apache HTTP Server:
1. First, make sure that mod\_dir module is enabled. You can check the apache configuration file (often named httpd.conf or apache2.conf) for the following line: \`\`\` LoadModule dir_module modules/mod_dir.so \`\`\` If the line is prefixed with a hashtag, remove it to enable the module.
1. To configure the mod\_dir module, locate the DirectoryIndex directive in the Apache configuration file. This directive specifies names of files that will be treated as directory indices.
For example:
\`\`\`
1. If none of the specified files is found, a directory listing gets generated by mod\_autoindex, if it is enabled. To disable directory listings, add `Options -Indexes` to your configuration, or comment out `LoadModule autoindex_module` line: \`\`\` #LoadModule autoindex_module modules/mod_autoindex.so Options -Indexes \`\`\`
1. After making changes, save and close the configuration file.
1. Finally, reload or restart Apache so the changes will take effect. The command to do this will depend on your system, but could be one of the following: \`\`\` sudo systemctl restart apache2 \`\`\` or \`\`\` sudo /etc/init.d/httpd restart \`\`\`
Remember, this may vary depending on the Apache version and the operating system you are using.