The directory index of a website refers to the default file that is displayed when a user accesses a directory on a web server without specifying a specific file in the URL. It acts as the default landing page for a directory and is automatically loaded by the web server.
Typically, the directory index file is named "index.html," "index.php," or "index.htm," among others. When a user visits a directory, the web server looks for these index files in the directory and serves the first one it finds.
Here we cover how to modify the main index page of a site. This is useful when putting up an Under Construction page or any other splash page.
Change the Directory Index of a Page
- Log into cPanel
- Navigate to the File Manager, located in the Files section
- Navigate to the site's document root
- Edit the site's .htaccess file
TIP: If .htaccess is not present, show hidden files in File Manager. - Add a
DirectoryIndex
line at the top of the file
- The line will start with DirectoryIndex and end with the filename you want the URL to point to
EXAMPLE:
DirectoryIndex index.php
DirectoryIndex index.html
DirectoryIndex thisexamplepageijustmade.html
DirectoryIndex index.php index.html randomexamplepage.html
NOTE: The final example will attempt to load index.php, and if that file is not available it will try index.html next. If neither of those files exists, it will then try randomexamplepage.html. Make sure to place the filenames in order of preference.
- The line will start with DirectoryIndex and end with the filename you want the URL to point to
- Save the file
Comments
0 comments
Article is closed for comments.