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

XF 1.1 Session problem

Discussion in 'Installation, Upgrade, and Import Support' started by WebmasterHelp, Dec 3, 2012.

  1. WebmasterHelp

    WebmasterHelp New Member


    sorry for my bad english.
    My problem is when i open my website http://www.webmasterhelp.net and I log me in and would call my site without www. (http://webmasterhelp.net) the session is not longer active and I am not logged in. Why is this so?

    And where can I change the setting that there will not be shown the index.php in the url.
    Because when I enter http://www.webmasterhelp.net in the address bar the url is http://webmasterhelp.net/index.php (autamitcally with index.php).

    Thanks for help!

    Kind Regards
  2. Chris D

    Chris D XenForo Developer Staff Member

    The solution to both problems revolves around .htaccess.

    To remove the index.php from your URL, you will find a file called htaccess.txt in the root of your XenForo installation.

    You need to rename this to: .htaccess

    Then in Admin CP > Options> Search Engine Optimization > You need to enable Full Friendly URLs.

    The reason why the session isn't valid is because technically your site has two different URLs. One with www and one without.

    You need a way to redirect the non www version to your www version and to do that you should add these two lines to your .htaccess file:
    RewriteCond %{HTTP_HOST} !^www\.webmasterhelp\.net$
    RewriteRule ^(.*)$ http://www.webmasterhelp.net/$1 [R=301,L]
    That should redirect the non www version to www.
    Jake Bunce, WebmasterHelp and MattW like this.
  3. WebmasterHelp

    WebmasterHelp New Member

    Hi Chris,

    thanks for your fast answer.
    Enable Full Friendly URLs works to hide index.php, but the redirection with the htaccess doesn't work.

    This is my .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
    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 %{HTTP_HOST} !^www\.webmasterhelp\.net$
        RewriteRule ^(.*)$ http://www.webmasterhelp.net/$1 [R=301,L]
  4. WebmasterHelp

    WebmasterHelp New Member

  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Chris D likes this.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Chris D likes this.
  7. WebmasterHelp

    WebmasterHelp New Member

    Hi Jake,

    the redirection works now. But if I use Friendly URLs the index.php will not be desplayed but the urls doesn't work because on links the index.php is also not available.

    Yes I renamed to .htaccess
  8. Chris D

    Chris D XenForo Developer Staff Member

    I don't think you've enabled the Full Friendly URLs option in the Admin CP.
  9. WebmasterHelp

    WebmasterHelp New Member

    Of course I enabled Full Friendly URLs, if this option is disable it works.
  10. HWS

    HWS Well-Known Member

    Add this to your library/config.php file:

    $config['cookie'] = array(
      'path' => '/',
      'domain' => 'webmasterhelp.net'
    This will solve your issue.
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That will not work. That simply restricts cookies to a specific domain. He needs to enforce "www" so the visitor is only using one domain which is what that .htaccess code does.

    Possible causes of friendly URLs not working (usually manifests as "404 not found" error on forum pages):

    1) Your server doesn't have mod_rewrite installed. Consult with your host about this.

    2) Your server doesn't have AllowOverride enabled:


    Consult with your host about this.

    3) The .htaccess file is not in place in your forum directory.

    4) Sometimes you need to specify RewriteBase in your .htaccess file (specify the name of your forum directory):

    RewriteBase /xenforo
    Chris D likes this.
  12. WebmasterHelp

    WebmasterHelp New Member

    Hi Jake,

    thanks for your help. Number 4 works!

    Kind Regards
    Jake Bunce likes this.

Share This Page