• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Login Redirect

#1
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.
 

Jake Bunce

XenForo moderator
Staff member
#5
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>
 
#6
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>
 
#8
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>
 

Jake Bunce

XenForo moderator
Staff member
#10
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.