Login Redirect

onyxchase

Active member
Can I use this tag to redirect after logging in?

HTML:
<a href="/members/forums/login?redirect=/members/forums/" rel="nofollow">Login</a>
Some of my members say they receive a message that states they do not have permission to view this page after logging in, but if they go to the forums they are okay.
 

Brogan

XenForo moderator
Staff member
I use this on my Welcome page which is only available to guests:
Code:
<a href="{xen:link login/, '', 'redirect=.'}">Log In</a>
 

onyxchase

Active member
I take it I should be using this tag instead:
HTML:
<a href="/members/forums/login/?redirect=." rel="nofollow">Login</a>
 

Jake Bunce

XenForo moderator
Staff member
That looks correct, yes.

Some of my members say they receive a message that states they do not have permission to view this page after logging in, but if they go to the forums they are okay.
What is the URL of the page that shows that error? That error might be evidence that your redirect location is wrong.

Does your forum use friendly URLs or not? You need to keep that in mind when hard-coding the link. The non-friendly URL will always work though. For example:

Code:
<a href="http://www.domain.com/forum/index.php?login/&redirect=index.php?forums/main-forum.2/">Login</a>
And technically you should URL encode the parameter:

Code:
<a href="http://www.domain.com/forum/index.php?login/&amp;redirect=index.php%3Fforums%2Fmain-forum.2%2F">Login</a>
 

onyxchase

Active member
Hi Jake. Yes my forums use Friendly URLs. OK, so this is the code I put now. Please let me know if it's correct. :)

HTML:
<a href="http://www.domain.com/members/forums/index.php?login/&amp;redirect=index.php" rel="nofollow">Login</a>
 

onyxchase

Active member
Thanks Jake, much appreciated! I take it this URL should also be correct?

HTML:
<a href="http://www.domain.com/members/forums/register/facebook?reg=1&amp;redirect=index.php" rel="nofollow">Login with Facebook</a>
 

onyxchase

Active member
Thanks Jake, my members told me there are no longer any problems with being redirected after logging in with the -Login- link.
 

Jake Bunce

XenForo moderator
Staff member
Thanks Jake, much appreciated! I take it this URL should also be correct?

HTML:
<a href="http://www.domain.com/members/forums/register/facebook?reg=1&amp;redirect=index.php" rel="nofollow">Login with Facebook</a>
That appears correct. But I don't have a facebook account to test it.
 
Top