1

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

Matt
  • 383
  • 1
  • 5
  • 20
  • [This](http://stackoverflow.com/a/10410672/1960712) answer can help you – Rene Korss Mar 09 '15 at 18:00
  • possible duplicate of [After remove the www extension from addressbar session not working](http://stackoverflow.com/questions/10410591/after-remove-the-www-extension-from-addressbar-session-not-working) – Mariano D'Ascanio Mar 09 '15 at 18:11

2 Answers2

3

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.

Dannn
  • 318
  • 1
  • 7
  • do I need to restart server? I am using cpanel and it adds the following code when I use the cpanel interface. RewriteCond %{HTTP_HOST} ^foo\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.foo\.com$ RewriteRule ^(.*)$ "http\:\/\/foo\.com\/$1" [R=301,L] – Matt Mar 09 '15 at 21:30
  • Had some issue with where to place the code in the ht access. Below link helped http://serverfault.com/questions/225974/how-to-redirect-www-example-com-to-example-com-via-htaccess-while-on-zend-framew – Matt Mar 09 '15 at 22:56
  • Sorry, wasnt online at this time but im glad this has worked for you! – Dannn Mar 10 '15 at 09:01
0

I guess you can solve it configuring ZfcUser, anyway I recommend you to redirect to one domain. It is Better for SEO and also will solve your problem.

itrascastro
  • 775
  • 6
  • 14
  • How can I confirm the redirect is working? I've tried putting one in my htaccess file before without success. Will it literally re route the address from www.foo to foo.com in the browser when setup correctly? – Matt Mar 09 '15 at 18:31