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

301 redirect to prevent users logging out

Discussion in 'Server Configuration and Hosting' started by planetzu, Aug 4, 2013.

  1. planetzu

    planetzu Member


    I have been having issue with users getting logged out automatically even when they are still active on the forum. I guess the problem is with cookie scope due to inconsistent URLs as discussed in this post:


    The forum is in a subdirectory "/community" and I am trying to redirect all non-www pages to www. This is because I have a wordpress blog in the root which already uses 'non-www' to 'www' redirection.

    Also in the 'Basic Board Information' I have given the following as the URL:
    http://www.yoursite.com/community and the index page route is 'forums/'

    I used the following in the forum htaccess but it isn't redirecting:

    RewriteCond %{HTTP_HOST} ^yoursite\.com$
    RewriteRule ^(.*)$ http://www.yoursite.com/community/$1 [R=301,L]
    Is there anything I am doing wrong?

    I basically want to redirect http://yoursite.com/community/ to http://www.yoursite.com/community/
    Last edited: Aug 4, 2013
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Sheratan

    Sheratan Well-Known Member

    Try this:

    RewriteCond %{HTTP_HOST} !^domain\.com$
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
  4. planetzu

    planetzu Member

    Fixed it now. There was a minor flaw in my code, now it is redirecting fine. Thank you.

Share This Page