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

XF 1.5 Users keep get logged out.

Discussion in 'Troubleshooting and Problems' started by Spleen, Apr 1, 2016.

  1. Spleen

    Spleen Member

    Some users are reporting that they are being logged out spontaneously. One keeps getting logged out on his iPhone but remains logged in on a desktop, another reports being logged out every time he changes a page on his desktop and another one m,much the same sort of thing. Is there somewhere within XF that has a timeout or somesuch? Thanks.
     
  2. Amaury

    Amaury Well-Known Member

    First thing to check is to make sure that they're not all either going to www or non-www. You can force redirects to one or the other.
     
    Last edited: Apr 2, 2016
  3. Martok

    Martok Well-Known Member

    Spleen likes this.
  4. Spleen

    Spleen Member

    Ok, thanks chaps. I'll get on it.
     
  5. Spleen

    Spleen Member

    Noob question, where can I find the .htacccess file?
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    In the directory where XF is installed.
     
  7. Spleen

    Spleen Member

    Ok, I found it in filezilla. Can I edit it in that? (Someone else installed it for me, should I ask them to sort it for me?)

    Screen Shot 2016-04-01 at 23.38.22.png
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Download it to your computer using your FTP program.
    Open it in a text editor.
    Edit it.
    Upload it to the server using your FTP program (overwrite the existing file).

    That is the not the .htaccess file though - it is the htacces.txt file.

    The .htaccess file will be hidden, if it exists.
    Otherwise just rename the htaccess.txt file to .htaccess.
     
  9. Spleen

    Spleen Member

    Right, I'll have a look at this tomorrow when I have a clearer head!
     
  10. Spleen

    Spleen Member

    This is the .htaccess.txt file, is this what I need to save as .htaccess?

    # Mod_security can interfere with uploading of content such as attachments. If you
    # cannot attach files, remove the "#" from the lines below.
    #<IfModule mod_security.c>
    # SecFilterEngine Off
    # SecFilterScanPOST Off
    #</IfModule>

    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 405 default
    ErrorDocument 406 default
    ErrorDocument 500 default
    ErrorDocument 501 default
    ErrorDocument 503 default

    <IfModule mod_rewrite.c>
    RewriteEngine On

    # If you are having problems with the rewrite rules, remove the "#" from the
    # line that begins "RewriteBase" below. You will also have to change the path
    # of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    # This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
     
  11. Spleen

    Spleen Member

  12. Brogan

    Brogan XenForo Moderator Staff Member

  13. Spleen

    Spleen Member

    Ok, I'm out of my depth here so I'll just leave it.
     
  14. Brogan

    Brogan XenForo Moderator Staff Member

    It's quite simple.

    Just add the relevant rules to the .htaccess file, just after RewriteEngine On.
     
  15. Spleen

    Spleen Member

    I can't find the actual .htaccess file, I don't understand what 'Any custom rewrite rules must come before the XF rewrite rules' means and even if I do find the right file I have no idea exactly what to write in it.
     
  16. Brogan

    Brogan XenForo Moderator Staff Member

    You posted the default htaccess.txt file above.

    Simply rename it to .htaccess and add the new rules.


    You already posted the HTTPS code above.
     
  17. Spleen

    Spleen Member

    Ok, do I put my own site address in between the brackets where is says HHTP_HOST and REQUEST_URL?

    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
     
  18. Brogan

    Brogan XenForo Moderator Staff Member

    Add the code exactly as shown.
     
  19. Spleen

    Spleen Member

    Thanks, I'll have a go and see what happens.
     
  20. Spleen

    Spleen Member

    Ok, I did a search for the .htaccess file and found two. One file had 'order deny, allow Deny from all' and the other one had this:

    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    <IfModule mod_rewrite.c>
    RewriteEngine On
    # If you are having problems with the rewrite rules, remove the "#" from the
    # line that begins "RewriteBase" below. You will also have to change the path
    # of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo
    # This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    RewriteCond %{HTTPS} on
    RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]
    </IfModule>

    I'm assuming that I still put the code in after RewriteEngine On so it looks this:

    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 500 default
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    # If you are having problems with the rewrite rules, remove the "#" from the
    # line that begins "RewriteBase" below. You will also have to change the path
    # of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo
    # This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    RewriteCond %{HTTPS} on
    RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]
    </IfModule>

    Is that right?
     

Share This Page