{"id":640,"date":"2016-02-14T21:46:48","date_gmt":"2016-02-14T20:46:48","guid":{"rendered":"http:\/\/www.axew3.com\/w3\/?p=640"},"modified":"2024-05-19T14:38:22","modified_gmt":"2024-05-19T12:38:22","slug":"phpbb-login-redirect-external-domain-subdomain","status":"publish","type":"post","link":"https:\/\/www.axew3.com\/w3\/2016\/02\/phpbb-login-redirect-external-domain-subdomain\/","title":{"rendered":"phpBB external login redirect<br \/> how to &#8211; domain, subdomain"},"content":{"rendered":"<p>To correctly do an external <strong>redirect for domain in phpBB 3&gt;<\/strong> it is required to modify\/edit a single file in phpBB:<\/p>\n<p>open with text editor <em><strong>\/includes\/functions.php<\/strong><\/em><\/p>\n<p>search for the function <em><strong>redirect<\/strong><\/em><\/p>\n<pre class=\"lang:default decode:true\">function redirect($url, $return = false, $disable_cd_check = false)\r\n<\/pre>\n<p><strong>inside this function there is this code:<br \/>\n<\/strong><\/p>\n<pre class=\"lang:default decode:true\">else if (!empty($url_parts['scheme']) &amp;&amp; !empty($url_parts['host']))\r\n{<\/pre>\n<p><strong>just after this two lines, add the follow:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">$disable_cd_check = true;<\/pre>\n<p><strong>save and replace<\/strong> phpBB <em>includes\/functions.php<\/em>.<\/p>\n<blockquote><p>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 -&gt; www.yourdomain.com will not work).<\/p><\/blockquote>\n<p>Another way on the same <strong><em>function redirect<\/em><\/strong> of same file <strong><em>includes\/functions.php<\/em><\/strong><\/p>\n<p><strong>search for<\/strong><\/p>\n<pre class=\"lang:default decode:true\">function redirect($url, $return = false, $disable_cd_check = false)\r\n{\r\n global $user, $phpbb_path_helper, $phpbb_dispatcher;<\/pre>\n<p><strong>immediately after add the following code:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">global $request;\r\nif( $request-&gt;variable('mode', '') == 'login' &amp;&amp; isset($_POST[\"redirect\"]) ){\r\n$rwp = trim($_POST[\"redirect\"]);\r\nheader(\"Location: $rwp\");\r\nexit;\r\n}<\/pre>\n<p>Maybe a little check to this passed <em>redirect<\/em> 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).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To correctly do an external redirect for domain in phpBB 3&gt; 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[&#8216;scheme&#8217;]) &amp;&amp; !empty($url_parts[&#8216;host&#8217;])) { just after this [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[50,52,67,58,59],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-wordpress-phpbb-integration","tag-phpbb-external-login","tag-phpbb-external-login-redirect","tag-phpbb-secure-redirect","tag-secure-phpbb-login-redirect","tag-subdomain-redirect-phpbb"],"_links":{"self":[{"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":3,"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":2798,"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/posts\/640\/revisions\/2798"}],"wp:attachment":[{"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.axew3.com\/w3\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}