How To Change Default Index Page In .htaccess From 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.

Prerequisites

  • A Domain Name (example.com)
  • cPanel Credentials

Step 1:

Login into your cPanel using your username and passwordHow To Change Default Index Page In .htaccess From cPanel

Step 2:

Locate File Manager and Click on File Manager to access your website directory. You can also use a FTP Client to access it.

How To Change Default Index Page In .htaccess From cPanel

Step 3:

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.

How To Change Default Index Page In .htaccess From cPanel

Click on Save button.How To Change Default Index Page In .htaccess From cPanel

Step 4:

Open the .htaccess file located in the public_html directory.

How To Change Default Index Page In .htaccess From cPanel

Right-click the .htaccess file and Click on Edit. It will show up the Edit pop up. Click on Edit button.How To Change Default Index Page In .htaccess From cPanel

Step 5:

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.

Check out these top 3 cPanel hosting services:

Was this article helpful?