Multiple Index Files: Force Server to load index.php instead of index.html
Question by Guest | Last update on 2024-01-15 | Created on 2012-08-24
I have the following unusual problem: In my webspace directory is both an index.php and an index.html. For some reason, however, always the index.html is loaded first. But I would like that the index.php is loaded first instead.
Is there a way or is not changeable?
Related Topics
HTML5: Upload Images with Client Side Resize
Tutorial | 9 Comments
jQuery: Load and Replace DIV Content with clicking Links
Tutorial | 0 Comments
How to Replace multiple Texts at the same Time
Tutorial | 0 Comments
MySQL: Line Breaks in MySQL
Tip | 0 Comments
How to resize Image before Upload in Browser
Tutorial | 13 Comments
XAMPP: How to set up SSL/HTTPS for local Projects
Tutorial | 4 Comments
HTACCESS: Simplify URL
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
Why do you have an index.html and an index.php in the directory? That does not really make much sense, does it?
I would leave only one of these index files in the directory and give the rest of the files different names or you can only link them from another folder. Then you have not the problem.
Last update on 2024-01-15 | Created on 2012-08-27
You can customize your htaccess file to determine an access order to the index files.
Just add the following line into your htaccess:
This will force the server to first look for the file index.php and then subsequently for the file index.html (if no index.php exists). If both files are not present, there will be an Access Forbidden Error (403) or the directory with all the files will be displayed.
By the way, you can also specify files after DirectoryIndex that are not named "index" at all. For example:
With this, first the abc.html is displayed, if available. And after that, def.php or index.php - depending on which of these files are available.
Last update on 2024-01-15 | Created on 2012-08-26