Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Joomla Bridge Support => Topic started by: DCB on May 14, 2007, 04:29:34 PM

Title: trouble redirecting to wrapped forum
Post by: DCB on May 14, 2007, 04:29:34 PM
I'm trying to redirect so people can't access /forum directly.

I put in the following code to my index.php
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false && strpos($_SERVER['QUERY_STRING'], 'verificationcode') ===

false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=51&".$_SERVER['QUERY_STRING']); }
}

But that redirect back to my home page. Am I missing something?
Title: Re: trouble redirecting to wrapped forum
Post by: SlammedDime on May 14, 2007, 04:46:41 PM
Quote from: DCB on May 14, 2007, 04:29:34 PM
I'm trying to redirect so people can't access /forum directly.

I put in the following code to my index.php
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false && strpos($_SERVER['QUERY_STRING'], 'verificationcode') ===

false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=51&".$_SERVER['QUERY_STRING']); }
}

But that redirect back to my home page. Am I missing something?
I can't remember ATM what I have, but I believe you need the entire url in the Location: header, not just /index.php....

ie:  Location: http://www.myurl.com/index.php?option=com_smf&Itemid=51.........
Title: Re: trouble redirecting to wrapped forum
Post by: DCB on May 14, 2007, 04:53:30 PM
Awesome, that was it.
Title: Re: trouble redirecting to wrapped forum
Post by: GladToBeHere on August 05, 2007, 09:16:02 AM
Thanks for sharing! I was looking to do the exact same thing so that users couldn't bypass my Joomla! wrapped forum.

Cheers!
Title: Re: trouble redirecting to wrapped forum
Post by: kai920 on June 20, 2008, 08:39:26 AM
I used this code, it redirects /forums to my wrapped joomla installation successfully, but appends a www after the URL?

The is the URL if I go to /forums:
"index.php?option=com_smf&Itemid=71&www"

// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false && strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=71&".$_SERVER['QUERY_STRING']); }
}