Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-24-2010, 05:58 PM   PM User | #1
Saeid
New Coder

 
Join Date: Jun 2010
Location: Enschede, Netherlands
Posts: 34
Thanks: 18
Thanked 0 Times in 0 Posts
Saeid is an unknown quantity at this point
redirect / to /index.php

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.
__________________
ELECTRONICSPUB.COM
All about electronics and hardware
Saeid is offline   Reply With Quote
Old 07-25-2010, 08:23 AM   PM User | #2
gameutopia
New Coder

 
Join Date: Mar 2010
Posts: 27
Thanks: 0
Thanked 1 Time in 1 Post
gameutopia is an unknown quantity at this point
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.
__________________
dolphin tutorials and Resources
gameutopia is offline   Reply With Quote
Old 07-25-2010, 05:18 PM   PM User | #3
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 07-25-2010, 06:28 PM   PM User | #4
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Quote:
Originally Posted by Fou-Lu View Post
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.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:01 AM.


Advertisement
Log in to turn off these ads.