I have a phpbb forum (eg. forum.domain.com) and a Wordpress site (accounts.domain.com).
The forum login and registration is handled by Wordpress via SSO.
There are 2 registration pages:
The first link is specific and restricted for the forum only and I only want users clicking the Register link on forum.domain.com access the first page while other users trying to access the first page gets redirected to the second page.
Is there any way to achieve this?
You could use $_SERVER variable to check the referer and make decision.
Code:
<?php
$referrer = $_SERVER['HTTP_REFERER'];
if ( $referrer != 'http://forum.domain.com' ) {
header( 'Location: http://accounts.domain.com/registration/ ' ) ;
}
?>
This code will check the referer, if user is not coming from http://forum.domain.com
then it will redirect to normal registration page.
This code should be placed on forum registration page.
Hope it helps! :)