XF 1.1 Session problem

WebmasterHelp

New member
Hi,

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

That should redirect the non www version to www.
 
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
Code:
#    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 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]
</IfModule>
 
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
 
Add this to your library/config.php file:

Code:
$config['cookie'] = array(
  'path' => '/',
  'domain' => 'webmasterhelp.net'
);

This will solve your issue.
 
Add this to your library/config.php file:

Code:
$config['cookie'] = array(
  'path' => '/',
  'domain' => 'webmasterhelp.net'
);

This will solve your issue.

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.

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

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:

http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

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):

Code:
RewriteBase /xenforo
 
Back
Top Bottom