How To Change Default Index Page in .htaccess at cPanel

When you enter a URL on your web browser, the server looks for the first page of your website, also called index page. Usually, the default first page of a website are index.html, default.html, or index.php.

When you need a custom name for your index file or want to migrate your website from another and the index page has a custom name, you need to change the default index name.

This guide will teach you the process to change the default index page by making some changes in the .htaccess file using the cPanel.

Step.1: Login into your cPanel using your username and password
Step2: Locate File Manager and Click on File Manager to access your website directory. You can also use a FTP Client to access it.
Step3: Click on Settings from the top right corner to access the Settings menu. Select the Document Root and make sure Show Hidden files(dotfiles) is selected. Click on Save button.
Step4: Open the .htaccess file located in the public_html directory.
Step5: Right-click the .htaccess file and Click on Edit. It will show up the Edit pop up. Click on Edit Button.
Step6: Add the following line of code in your .htaccess file to configure your index page.

#Custom default index page
DirectoryIndex welcome.html

You can also add more than one file. The server will read the file from left to right. If the server doesn’t find the first one, it will look for another one in the right.

#Custom default index pages
DirectoryIndex welcome.html hello.htm welcome.html first.php

Click on Save Changes from the top right corner to save the new changes.

Conclusion

In this guide, you learned the process to change your default index page in a .htaccess file using the control panel.

You may also like