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

Login Redirect

Discussion in 'XenForo Questions and Support' started by onyxchase, Feb 19, 2011.

  1. onyxchase

    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.
     
  2. Brogan

    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 likes this.
  3. onyxchase

    onyxchase Active Member

    Thanks Brogran, but this is going on a non-forum page. On an HTML on http://www.domain.com/index.html :) Is my syntax correct or is it what could be causing some of my problems.
     
  4. onyxchase

    onyxchase Active Member

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

    Jake Bunce XenForo Moderator Staff Member

    That looks correct, yes.

    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 likes this.
  6. onyxchase

    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>
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Looks good to me. That should redirect them to the forum index after they login.
     
    onyxchase likes this.
  8. onyxchase

    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>
     
  9. onyxchase

    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.
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That appears correct. But I don't have a facebook account to test it.
     

Share This Page