- In a production server there are index.html and index.php
- By default index.html is getting loaded.
- I want index.php to be the default script to load and if index.php is not present then index.html can load.
- It is a shared hosting so we do not have access to the httpd.conf file
-
So i thought of creating .htaccess file which would do the above condition.
What is the directive to include in .htaccess file to do so?
Besides, here i am explaining the reason for the above.
- The php project is done in codeigniter framework.
- in a sub folder from the root we have oscommerce.
- We do not have any index.html there and only index.php was present.
- Periodically an index.html was created by some means which has an iframe code.
- The client reports this and we keep deleting the index.html file
- We have also changed the ftp password.
- so what i thought as a temp solution is to make index.php be loaded as default instead of index.html
3
Answers
As per the Apache documentation for DirectoryIndex, simply put the following in a
.htaccess
file in the same directory asindex.php
:DirectoryIndex index.php index.html
It depends on Apache Directory Index configuration. You can customize it as per your needs: