如何在 Symfony2 中删除 PHPSESSID [英] How I can remove PHPSESSID in Symfony2

查看:32
本文介绍了如何在 Symfony2 中删除 PHPSESSID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上部署了我的网站并且一切正常,但我在页面链接的末尾有类似的东西:

I deployed my website on line and all works fine,but I have in the end of link of pages something like that :

../..?PHPSESSID=....

所以我的问题是如何从我网站的所有页面的路径中删除 PHPSESSID cookie?

So my question is about how to remove the PHPSESSID cookies from the path of all pages in my website?

编辑

所以我找到了一个很好的解决方案,只是我把这段代码放在我的 .htaccess 中的 web 文件夹中:

So I find a good solution,just I put this code in my .htaccess in web folder :

<IfModule mod_rewrite.c>

 RewriteEngine On

 #remove PHPSESSID 

  RewriteCond %{QUERY_STRING} PHPSESSID=.*$ 

  RewriteRule .* %{REQUEST_URI}? [R=301,L]

 </IfModule>

永远不要让 ?PHPSESSID 再次损害您的排名!

Never let ?PHPSESSID hurt your rankings again!

推荐答案

PHPSESSID 不是由 Symfony 添加的,PHP 被配置为将 PHPSESSID 变量附加到 URL 以允许 PHP 跟踪会话.您可以使用

PHPSESSID is not added by Symfony, PHP is configured to append the PHPSESSID variable to the URL to allow PHP to track the session. You can disable this behavior by using

ini_set('session.use_trans_sid',false);

请参阅我的网络主机将 ?PHPSESSID=fgh2h45... 添加到 URL 的末尾以获取更多详细信息

Please see My web host is adding ?PHPSESSID=fgh2h45... to the end of the URL for more details

这篇关于如何在 Symfony2 中删除 PHPSESSID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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