I’ve created Compute Engine VM instance and selected CentOS 7 as the image, on which I’ve installed cPanel, created a DNS zone and set up a firewall for.
After logging in into the Web Host Manager, I created a cPanel account, uploaded my PHP website into the public_html
folder, and imported the SQL database into phpMyAdmin.
Now, the problem is that instead of loading index.php
the site is showing index.html
.
I checked the PHP version, and it is compatible with my website which is using alt-php 5.6
. I’ve also installed ea-php 5.6
on the VM and changed the PHP version in cPanel on my domain.
However, the website’s main domain is still loading index.html
instead of index.php
. Can someone help me understand why and how to fix it?
2
Answers
If you browser to /index.php does it work? If so and you’re using Apache you’ll want to set the “DirectoryIndex index.php” in the virtual host or in the “.htaccess” file.
Or if you can just delete the index.html file.
As far as I’m aware of, the default order of index file names that a server looks through is: index.htm, index.html, index.php and finally default.htm.
It is possible to change the name of the index file your account looks for by altering the .htaccess file, as already suggested by other user (in the example below, you’d set a file called “first.html” as the index page:
/#Alternate default index page
DirectoryIndex first.html
In case you need to have a specific custom name for your index file or maybe you are migrating from another host and the index page is named differently so your internal links won’t be eventually broken by renaming the index file.
Greetings!