Page 1 of 1

Redirect to folder

Posted: Tue Mar 08, 2005 6:38 am
by JF3000
Hi,

I know this line that goes at the beginning of the page will redirect the user to that file.

Code: Select all

<?php  include('index_default.php'); ?>
In my phpBB folder I was to place a command in the index.php at the top to tell the page not to load and go to a folder in the same directory, is it as easy as :

Code: Select all

<?php  include('foldername/index.php'); ?>
??

Thank you.

JF3000

Posted: Tue Mar 08, 2005 6:45 am
by CoderGoblin
The answer to your question appears to be Only if the your current file has no output but the redirected file does. I would like to try to clarify a possible misconception...

Include does not "move" the user to the indicated page. It actually inserts the indicated file into the current file. http://www.php.net/manual/en/function.include.php

To "move" you would use the command header("Location: newlocation.php"); This would change the url bar at the top of the browser. By using "include" this browser relocation does not happen.

Hope that clarifies things a bit.

Posted: Tue Mar 08, 2005 6:58 am
by JF3000
I am totally lost by what you say, here is my predictament :

I have phpBB installed, I have a frontend of a phpBB done in flash, the location of the forum in flash is phpBB/Flashbb

If you go to the website with websitehere.com/phpBB/Flashbb the site loads the flash phpbb, but if you just went there normally :

websitehere.com/phpBB then it loads the basic phpBB website.

What I would like to be able to do is mvoe the user from the websitehere.com/phpBB/index.php area to the websitehere.com/phpBB/FlashBB/index.php area.

Hope this makes a little more sense.

I didnt know what include meant, im still trying to understand everything everyone tells me so thank you for the reply though.

JF3000

Posted: Tue Mar 08, 2005 7:02 am
by Chris Corbyn

Code: Select all

<?php header('location: index_default.php'); ?>
Right at the VERY top of the page that will force the redirect....

Posted: Tue Mar 08, 2005 7:06 am
by JF3000
So where it says location, if I place FlashBB and the other bit as index.php and place this in the index.php file located in the phpBB file this will force the user to the other area?

Posted: Tue Mar 08, 2005 7:12 am
by Chris Corbyn
Yes. Test it :wink:

If it doesn't work first time play around with which file it needs to be until it does work.

In other words... whatver loads by default needs to redirect, so put the header('location:... code at the top of the default file to force a redirect