2014-06-08, 12:02 PM
Is there a way to check for invalid forum before the main script starts checking its things like setting cookies and stuff?
I would like to create a plugin that will return 301 header for invalid forum, thread, post?
For some it works but for many it doesn't cause it says:
http://letsforum.com/Forum-Adwords-Forum - 301 Moved Permanently
http://letsforum.com/forumdisplay.php?fid=163 - 301 Moved Permanently
Why it should redirect to my homepage not to fid?
How can I fix that?
I would like to create a plugin that will return 301 header for invalid forum, thread, post?
{
global $mybb;
$fid = intval($mybb->input['fid']);
$foruminfo = get_forum($fid);
if(!$foruminfo)
{
if (in_array($mybb->user['usergroup'], array('3','4','6'))) {
error("Invalid Forum");
}
else
{
header("Location: {$mybb->settings['bburl']}", true, 301);
exit();
}
}
}
For some it works but for many it doesn't cause it says:
http://letsforum.com/Forum-Adwords-Forum - 301 Moved Permanently
http://letsforum.com/forumdisplay.php?fid=163 - 301 Moved Permanently
Why it should redirect to my homepage not to fid?
How can I fix that?