带有-www和不带有-www的网址的不同会话 [英] different session with url's with-www and without-www

查看:64
本文介绍了带有-www和不带有-www的网址的不同会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含作者的交互式网站. 当作者进入www.mysite.com上的站点并登录时,会话变量变为

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;

和网站主题更改.

但是即使他登录也进入mysite.com(不带www的网站)时,他仍会看到默认主题,无法编写等. 我认为他们是不同的会议,对吗?它取决于我的服务器或浏览器还是什么?我该如何进行这两个相同的会话,或将用户的会话从一个重定向到另一个?

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?

推荐答案

将此添加到您的.htaccess文件中:

Add this to your .htaccess file:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ http://www.mysite.com$1 [R=permanent,L]

这篇关于带有-www和不带有-www的网址的不同会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆