skip to Main Content
  1. In a production server there are index.html and index.php
  2. By default index.html is getting loaded.
  3. I want index.php to be the default script to load and if index.php is not present then index.html can load.
  4. It is a shared hosting so we do not have access to the httpd.conf file
  5. 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.

  1. The php project is done in codeigniter framework.
  2. in a sub folder from the root we have oscommerce.
  3. We do not have any index.html there and only index.php was present.
  4. Periodically an index.html was created by some means which has an iframe code.
  5. The client reports this and we keep deleting the index.html file
  6. We have also changed the ftp password.
  7. so what i thought as a temp solution is to make index.php be loaded as default instead of index.html

3

Answers


  1. As per the Apache documentation for DirectoryIndex, simply put the following in a .htaccess file in the same directory as index.php:

    DirectoryIndex index.php index.html
    
    Login or Signup to reply.
  2. DirectoryIndex index.php index.html

    Login or Signup to reply.
  3. It depends on Apache Directory Index configuration. You can customize it as per your needs:

    DirectoryIndex index.html index.shtml index.php index.htm 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search