I'm using WordPress and I would to redirect all unauthorized users to the homepage.
In order to do so in the header file I put (at the begin of the file) the following PHP code:
if (bp_current_component() != ""
&& bp_current_component() != "event"
&& !is_user_logged_in()
&& !isset($_COOKIE[affiplus])
&& !isset($_GET[affid]))
{
header( "HTTP/1.1 410 Gone" );
header( "Location: ".get_option('siteurl')."/home/");
}
Unfortunately the HTTP error code returned is always 302 (Moved permanently) and not 410 as I want. Why?