Modifying the default (index) file a webpage loads from
PLEASE NOTE: This method is for advanced users. If you’re unfamiliar with modifying your website’s .htaccess file it is best to seek advice from a professional web designer.
Why would I want to change the index on a page of my website?
By default, most web hosting servers (and certainly ours) will use index.php or index.html as the index page – the page that loads in your web browser when a URL is visited. You might seek to change this to temporarily display a “maintenance” page while you work on the website, or perhaps you’d rather keep the file name of your site’s code a certain format.
Here’s how you can change that!
- Navigate to the .htaccess file for the directory you’re working in. You can do this via cPanel’s File Manager or using FTP.
- Edit the .htaccess file to include the following code at the top:
DirectoryIndex newfile.phpBe sure to replace newfile.php to the name of the file that you wish to change your index page to. Make sure this file is in the same directory you’re working in!
- Save the changes you’ve made.
That’s it! Now the page you’re working on will load from your nominated file.