How do I change default 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.

  • Login into your cPanel using your username and password.
  • Locate File Manager and click on File Manager to access your website directory. You can also use a FTP Client to access it.
  • 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.
  • Open the .htaccess file located in the public_html directory.

Right-click the .htaccess file and click on Edit. It will show up the Edit pop up. Click on Edit button.

  • 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.

Was this article helpful?

Related Articles