0

Can anybody tell me which file will be loaded first if we have 1. index.php 2. index.html

files on server?

I want to install wordpress site on same domain, at the same time, I want to load my index.html page as a holding page until I properly launch website. How can I do this?

3 Answers 3

2

If you use Apache (which I assume you do since you tagged this with htaccess) you can change your Apache config/htaccess's DirectoryIndex property to include the order of priority of index files:

DirectoryIndex index.html index.htm index.php index.php4 index.php5

Here's the "algorithm":

  • Does index.html exist in the current folder? If yes, then load it, if no, continue:
  • Does index.htm exist in the current folder? If yes, then load it, if no, continue:
  • Does index.php exist in the current folder? If yes, then load it, if no, continue:
  • Does index.php4 exist in the current folder? If yes, then load it, if no, continue:
  • Does index.php5 exist in the current folder? If yes, then load it, if no, continue:
  • Send a 404 page not found error

Which means you can create an index.html file and then delete it once you want your site to run normally. Keep in mind that anyone can still access index.php if they wish - they just need to specify it.

Sign up to request clarification or add additional context in comments.

Comments

0

Thant actually depends on your DirectoryIndex directive. Set it up as:

DirectoryIndex index.php index.html

This will load index.php if it is available, if not then it will try to load index.html.

Comments

0

Put in .htaccess:

DirectoryIndex index.html index.php

The server will load the old html page first.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.