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?
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.........
Awesome, that was it.
Thanks for sharing! I was looking to do the exact same thing so that users couldn't bypass my Joomla! wrapped forum.
Cheers!
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']); }
}