Default Directory index page
When a request is made to a URL that points to a directory instead of an actual file within a directory, web servers will typically serve a default index page such as an index.html or index.php file. If this file does not exist on the server or the server is not configured to display this file, a list of all the files and directories located inside the current directory may be displayed.
Users can modify what index file is loaded by default when a directory is navigated to.
Directory index files on cPanel Hosting
Follow the instructions below to modify the default index page on cPanel Hosting accounts.
Please note that modifying the directory index file on a cPanel Hosting account requires users to modify their .htaccess file. If modified incorrectly, you could break your live website. It is recommended you backup your .htaccess file before attempting to make any changes to it.
- Log into your Account
- Find the cPanel in question and log in
- Click the File Manager icon
- Select Home Directory
- Tick the box next to Show Hidden Files (dotfiles)
- Click [Go]
- Navigate to the public_html directory
- If a .htaccess file exists, select it then click the Edit icon
- If no .htaccess file exists, click on the New File icon and create a file called .htaccess
- Type in the below code into your .htaccess file
#Example DirectoryIndex index.php index.html index.htm
DirectoryIndex filename
- If you want to add additional default index file options, you can add a space and include additional file names
eg. DirectoryIndex index.php index.htm index.html Index.html - Once done making the appropriate changes, click [Save Changes]
.htaccess files work recursively, meaning all the subfolders that do not have their own .htaccess file will listen to the directive given by the .htaccess file placed in the root directory.
Updated about 1 month ago