phpzend-frameworkzend-framework2zfcuser

Different login states when using www vs no www


I am using zfc user and am having issues with users being logged in/out based on web address. If the user logs in at www.foo.com they are able to access all their pages. However if they move to foo.com they must re log in. How can I prevent this? Is this something with the server or zfc user?

Thanks Matt

Follow Up

I see it is a possible duplicate. I guess I'm trying to figure out if the issue is with the module managing the user log in or is it something I can fix with a redirect (www vs non www)?


Solution

  • If you want to use www only, in your .htaccess, include this code:

    RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    

    and vice versa for using without. Its always recommend to use just one for SEO reasons and in your case CMS's, I went through the same using Concrete5.