View Full Version : Redirects to Forums

11-20-2010, 12:47 AM
i have a gateway page on my server that has a picture. when i click on the picture while testing my site offline, it goes straight to the website. however, after i uploaded it to the server, clicking the picture goes straight to the forums.

strangely enough, the address bar still reads home.php (the intended page). after messing around a bit with home.php's code, i noticed that removing the line $user->setup(); seems to solve the redirect problem. unfortunately it seems to screw up a lot of the code that relies on proper PHPBB cookie management.

this didn't happen when i uploaded the forums directory directly from my hard disk, but after i did a clean install of PHPBB (using the automated PHPBB installation process instead of manually copying the folders) this problem appeared.

11-20-2010, 01:55 AM
If you can track down exactly what php line is outputting the URL for your image <a href> tag, then that's a step in figuring things out.

Maybe there is a PHPBB configuration setting/file on your remote server that you need to change? that setting or file is probably different than your local machine, so that is maybe why it is going to a different URL.

Or you could just hack the gateway page, like you attempted and hardcode the URL for your image link. Maybe paste the relevant PHP code in your gateway page here.

11-20-2010, 09:24 AM
It seems that line of code i'd stated was causing the site to redirect isn't actually necessary for proper cookie management. the content was broken because i hadn't properly edited the file with MySQL database/user/host variables to match the new database's.

the gateway page is actually written in pure HTML, it has an image linked to the main site (home.php).

the problem seems to lie in home.php's PHP code, specifically in the lines of PHP i copy/pasted for PHPBB cookie management:

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management

when i remove $user->setup(); from the code then home.php actually loads. unfortunately, a lot of the site's content which is dependent on PHPBB cookie management gets broken. if i keep that line in, however, the site automatically redirects to my forums.

11-21-2010, 12:21 AM
Glad you got it working and thanks for posting your solution. It may help others in the future.