folder defaults to wrong file

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
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

folder defaults to wrong file

Post by irealms »

Atm i have just installed a portal system for a community style site. The main page is called portal.php. The domain i use for this site has a folder set as it's home directory. The problem is when going to the domain URL the browser defaults to index.php which is the forum index and not portal.php which is the main page. How can i make it default to portal if no file has been set via a link?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I think you can do this in the apache.conf file - PHP does something similar when it's installed. A simpler way to do this though would be to make an index.php file with one line in it.

Code: Select all

header("Location: portal.php");
This isn't ideal, as index.php will still be in their history, but I think you can delete that using javascript in portal.php
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

Post by irealms »

yeah the only problem here is that the index i have atm is for the forums script so i can't really replace it. :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

should potentially be able to rename the forums script without too much trouble.
User avatar
Gonik
Forum Newbie
Posts: 19
Joined: Fri Aug 30, 2002 7:39 am
Location: Somewhere Around Nothing

Post by Gonik »

You can do what feyd said. But i recommend moving the forum to a folder named eg ./forum/ and leave the portal.php where it's located. Then rename it to index.php.
In most cases you'll also need to edit it, so it points to your forums dir. try using the chdir() function in the beggining of the file.

Code: Select all

<?php
chdir('./forum/');
// rest of the code goes here...
?>
Post Reply