axew3.com

phpBB external login redirect
how to – domain, subdomain

by

To correctly do an external redirect for domain in phpBB 3> it is required to modify/edit a single file in phpBB:

open with text editor /includes/functions.php

search for the function redirect

function redirect($url, $return = false, $disable_cd_check = false)

inside this function there is this code:

else if (!empty($url_parts['scheme']) && !empty($url_parts['host']))
{

just after this two lines, add the follow:

$disable_cd_check = true;

save and replace phpBB includes/functions.php.

Consider that this solution not meant to redirect to cross-domains and only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work).

Another way on the same function redirect of same file includes/functions.php

search for

function redirect($url, $return = false, $disable_cd_check = false)
{
 global $user, $phpbb_path_helper, $phpbb_dispatcher;

immediately after add the following code:

global $request;
if( $request->variable('mode', '') == 'login' && isset($_POST["redirect"]) ){
$rwp = trim($_POST["redirect"]);
header("Location: $rwp");
exit;
}

Maybe a little check to this passed redirect url, if it is coming from WordPress side, or within phpBB, or from a needed specific domain to redirect to should be done (may not).