Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当使用 no-www 版本(我通常使用的)的前缀访问我的网站时www,我发现我不再登录......这是为什么?
www
有没有办法让网站的两个版本使用相同的SESSION变量或至少重定向到一个版本,以防止内部重定向将用户从一个版本切换到另一个版本(我所有的重定向都使用相对路径,所以我不认为会是一个问题,但我没有经验,所以我不确定)?
SESSION
将以下内容添加到您的.htaccess文件中
.htaccess
RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com$1 [R=permanent,L]
将其重定向到一个地方(即 www.example.com)将有助于 SEO 并解决您的不同会话变量的问题,因为它始终属于 www 版本。