Site users logged out if the URL switches from http://www.mysite and http://mysite.com

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 20, 2016   (RSS)

My first question is there a way to solve this issue? I've set my site links to absorb whatever URL the user comes from however it seems like something that would be good to solve regardless.

If a user on my site is logged in but visits a URL with or without the www (opposite to the one they logged in on) they are show a page saying they need to log in. The cookie is infact still there though because if you put www infront of the page, or remove if then you can then see the page.

This is causing me a particular problem now as I have an externally hosted forum with a header made to appear like you are still on the main website. I have to directly link to http://www.mysite.com to get the header links to work. So anyone who has logged in under http://mysite.com and clicks on a link with the forum is taken to a page saying they are not logged in.

Any help with this appreciated!

By Damon - May 20, 2016

Update for anyone else with this issue:

The Membership sets the full URL when the user logs in. So if a user logs in without www, then goes to another page, clicks a link with www, they are no logged into the site as this is a different URL.

The solution is to make the site automatically redirect users that connect without www to the full url with www: http://www.site.com

This can often be done in the hosting control panel or with htaccess file code. Check with the host for the exact code to use.

A quick search brought up this example but I haven't tried it out:
http://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/