...

View Full Version : redirect / to /index.php



Saeid
07-24-2010, 05:58 PM
Dear friends,

I want to redirect people to index.php like this
http://www.electronicspub.com/
TO
http://www.electronicspub.com/index.php

because for some reasons I have a index.html also there.

gameutopia
07-25-2010, 08:23 AM
If you have both index.php and index.html in your root directory and you do not need the index.html you can just remove it. You could temporarily rename it index2.html to test it. It used to be index.html/index.htm were looked for first and then index.php. If only 1 index.whatever is present it will just find that. If both or other forms are present it will most likely look for index.htm/.html first. If you do not need index.html then by all means get rid of it. If you are not sure back up the file first and then try it.

Fou-Lu
07-25-2010, 05:18 PM
I also wouldn't write a redirection, but I wouldn't rename the index.html either. The reason why I wouldn't is because if the default is to have a directory listing show up and PHP fails for whatever reason then it will show a directory listing instead of whatever the index.html file is.
Open your httpd.conf file and search for DirectoryIndex. This should register the load order of each file type if just a directory is requested (the index.php file for example). Alter this to move index.php to the left and index.html somewhere to the right of index.php. Restart your apache, and it should now serve your PHP files instead of html ones.

oracleguy
07-25-2010, 06:28 PM
Open your httpd.conf file and search for DirectoryIndex. This should register the load order of each file type if just a directory is requested (the index.php file for example). Alter this to move index.php to the left and index.html somewhere to the right of index.php. Restart your apache, and it should now serve your PHP files instead of html ones.

You can also define the DirectoryIndex in a htaccess file.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum