Redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
westen
Forum Newbie
Posts: 14
Joined: Mon Oct 29, 2007 9:03 am

Redirect

Post by westen »

When someone types in the root url of my website index.html is displayed, I would like index.php to displayed. Could someone tell me how I can do this?

Thanks a lot for your help,
Westen
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

In Apache config file, change DirectoryIndex line to this one:

Code: Select all

DirectoryIndex index.php index.html
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Redirect

Post by Chris Corbyn »

westen wrote:When someone types in the root url of my website index.html is displayed, I would like index.php to displayed. Could someone tell me how I can do this?

Thanks a lot for your help,
Westen
Any one of:

1) Delete/rename the index.html file
2) Add a meta-based redirect

Code: Select all

<meta http-equiv="refresh" content="0; /index.php" />
3) If the server runs apache, create a file named ".htaccess" at the root of your website with the following:

Code: Select all

DirectoryIndex index.php
westen
Forum Newbie
Posts: 14
Joined: Mon Oct 29, 2007 9:03 am

Post by westen »

Thank you, I just deleted the index.html file. Is there no problems associated with this?


Cheers,
Westen
tokyowalker
Forum Newbie
Posts: 4
Joined: Sun Jul 15, 2007 8:45 am

Post by tokyowalker »

thanks ..had the same issue before
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

westen wrote:Thank you, I just deleted the index.html file. Is there no problems associated with this?
Not if you have an index.php file (and your server accepts it as the default).
Post Reply