Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess change DirectoryIndex priority to php and not html

  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
like image 205
Jayapal Chandran Avatar asked Feb 19 '11 07:02

Jayapal Chandran


2 Answers

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
like image 57
Andrew Marshall Avatar answered Nov 14 '22 06:11

Andrew Marshall


DirectoryIndex index.php index.html

like image 3
Zulan Avatar answered Nov 14 '22 05:11

Zulan