FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Why a 302 redirect? (I am looking to change the 302 redirect use on user profile page when not logged-in)
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Why a 302 redirect? [message #166902] Fri, 23 March 2012 18:45 Go to next message
rbenedetti is currently offline  rbenedetti   United States
Messages: 7
Registered: December 2010
Karma: 0
Junior Member
Hi,

For anonymous access, the URL of user profiles are redirected to the login page in FUDForum.
This makes sens however this is done using a 302 http redirect. I don't understand why and I need to change it.

Does anyone know how to change this to a 301 permanent redirect?
Otherwise a crawler will think the redirect will be temporary... and will try again and again to index the url.

And I should have given more context:
example of such a url:
forum.nuxeo.com/u/4828/

This takes me to forum.nuxeo.com/?t=login& but with an http 302 (which is wrong)

Thanks in advance

[Updated on: Fri, 23 March 2012 19:59]

Report message to a moderator

Re: Why a 302 redirect? [message #166904 is a reply to message #166902] Fri, 23 March 2012 20:10 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
You cannot as there isn't a single 302 redirect in the code!
Something else must me wrong, probably mod_security?
Re: Why a 302 redirect? [message #166906 is a reply to message #166904] Fri, 23 March 2012 20:16 Go to previous messageGo to next message
rbenedetti is currently offline  rbenedetti   United States
Messages: 7
Registered: December 2010
Karma: 0
Junior Member
Oh really!
Gosh I am not the one who installed FUDForum but may be they did something wrong at installation.
Any idea then why my urls which are my site.com/u/userid don't go to the profile but to the login page?
Re: Why a 302 redirect? [message #166907 is a reply to message #166904] Fri, 23 March 2012 20:21 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Wait a minute, 302 (Found) may be implied if nothing is specified.
If so, you will have to add 301 (Moved Permanently) explicitly in cookies.inc.t, function ses_anonuser_auth().
Remember to rebuild the theme to implement your changes.
Re: Why a 302 redirect? [message #166908 is a reply to message #166906] Fri, 23 March 2012 20:26 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
rbenedetti wrote:
Any idea then why my urls which are my site.com/u/userid don't go to the profile but to the login page?


Setting "Hide user profiles" is probably set to YES?

If so, anonymous and unconfirmed forum members will not be able to view profiles of registered users.
Re: Why a 302 redirect? [message #166909 is a reply to message #166908] Fri, 23 March 2012 20:48 Go to previous messageGo to next message
rbenedetti is currently offline  rbenedetti   United States
Messages: 7
Registered: December 2010
Karma: 0
Junior Member
Thanks a lot!
The two answers make a lot of sense, sorry for being a newb!

I will try one way or the other..

Roland
Re: Why a 302 redirect? [message #166910 is a reply to message #166907] Fri, 23 March 2012 20:51 Go to previous messageGo to next message
rbenedetti is currently offline  rbenedetti   United States
Messages: 7
Registered: December 2010
Karma: 0
Junior Member
Hi,

Thanks again. A last note on this one.

I found the function
"function ses_anonuser_auth($id, $error)
{
if (!empty($_POST)) {
$_SERVER['QUERY_STRING'] = '';
}
q('UPDATE {SQL_TABLE_PREFIX}ses SET data='. _esc(serialize($error)) .', returnto='. ssn($_SERVER['QUERY_STRING']) .' WHERE id='. $id);
if ($GLOBALS['FUD_OPT_2'] & 32768) { // USE_PATH_INFO
header('Location: {FULL_ROOT}{ROOT}/l/'. _rsidl);
} else {
header('Location: {FULL_ROOT}{ROOT}?t=login&'. _rsidl);
}
exit;
}"

however I am not that technical. Can you give more info on the syntax so that I can try?

Thnaks again!
Re: Why a 302 redirect? [message #166915 is a reply to message #166910] Sat, 24 March 2012 14:34 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Google for PHP and header().
Re: Why a 302 redirect? [message #166916 is a reply to message #166915] Mon, 26 March 2012 13:31 Go to previous message
rbenedetti is currently offline  rbenedetti   
Messages: 7
Registered: December 2010
Karma: 0
Junior Member
Thanks!
For now I simply authorized user profile. I guess this will be enough for what I want to accomplish.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Quote depth limiter - mod or plugin
Next Topic: Add a canonical link to the message page
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 10:05:39 GMT 2024

Total time taken to generate the page: 0.02304 seconds