Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

different session with url's with-www and without-www

Tags:

url

php

session

I have a interactive web site that has authors. When an author enters the site on www.mysite.com and logs in, the session varible becomes

$_SESSION[loggedid]=true;

and site-theme changes.

But when he enters mysite.com (without www's) even he is logged in, he sees the default theme, can't write etc. I think they are different sessions, am i right? Is it depends on my server or browser or what? How can i make this 2, same sessions or redirect the user's from one to one?

like image 490
Wond Avatar asked Jul 22 '11 01:07

Wond


People also ask

What is the difference between www and without www?

Over time, people began typing website names without the www when they searched for a website online. Webmasters took notice of this trend, and adopted a more naked domain approach. From a practical perspective, there is no difference between a www and a non-www URL.

Does changing www to non-www affect SEO?

Using www or a non-www URL won't affect your site's SEO. Using a www URL may have some technical benefits in a few areas and maybe for that reason, it should be considered over non-www. The main thing is to be absolutely consistent with your use. Once you choose www or not www—stick with that choice.

Should you redirect www to non-www?

Conclusion. People tend to leave the www out when typing a website's address. It might not cause significant issues since visitors will reach the same page, but it's best to redirect site visitors to its www version. This is because your site's performance and SEO might be affected if you keep using non-www domains.

Does removing www affect SEO?

Does it matter for SEO? In short, (directly) no. From an SEO perspective it doesn't make a difference whether you use WWW or not in front of your domain name.


1 Answers

Add this to your .htaccess file:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ http://www.mysite.com$1 [R=permanent,L]
like image 174
AlienWebguy Avatar answered Sep 28 '22 21:09

AlienWebguy