How Do I Tell Apache to Use Index.Htm Instead of Index.Php?

When you want to change the order in which the Apache Web server application file looks for index pages, you will need to edit the "httpd.conf" configuration file. This file includes a list of every file to look for, with the preferred files being listed first. After editing the file, you will need to refresh the server for changes to take effect.

Instructions

    • 1

      Go to "Start" on the Windows taskbar and enter "Notepad" in the search box. Navigate to "File" on the top menu in Notepad and select "Open..." Navigate to the "conf" folder inside your "Apache" folder, which is located where you installed Apache. On Windows systems, Apache is usually directly under the "C:\" drive. If you installed Apache as part of XAMPP or Wamp Server, look in one of these locations:

      C:\xampp

      C:\wamp\bin\apache\

    • 2

      Press "Ctrl+F" to bring up the "Find" tool in Notepad. Enter ".htm" in the "Find what" field and click "Find Next." Notepad will bring you to this block of code:

      <IfModule dir_module>

      DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm default.php default.pl default.cgi default.asp default.shtml default.html default.htm home.php home.pl home.cgi home.asp home.shtml home.html home.htm

      </IfModule>

    • 3

      Delete "index.htm" from the list and type it in front of "index.php" to make Apache serve "index.htm" first. If you want all HTML files to take precedence over PHP files, move those file names to the front of the list.

    • 4

      Save the file and restart Apache. Go to "Start" on the taskbar and enter "CMD" to restart from the command line:

      httpd -k restart

      Right-click on the XAMPP or Wamp Server icon if you installed Apache as part of either of those services. Click the "Refresh" button in XAMPP or select "Restart All Services" in Wamp Server to restart Apache.

Related Searches:

References

Comments

Related Ads

Featured