Tob*_*oby 18 php apache google-chrome
使用谷歌浏览器,我似乎在页面之间导航时丢失/损坏会话数据(PHP 5.0.4,Apache 2.0.54).该网站在IE7/8,Firefox,Safari和Opera中运行良好.该问题仅适用于Google Chrome.
我缩小了问题范围.我正在使用搜索友好的URL,并通过.htaccess文件隐藏我的前端控制器(index.php).所以URL看起来像:www.domain.com/blah/blah/这是.htaccess文件内容:
Options +FollowSymlinks
RewriteEngine on
#allow cool urls
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
#allow to have Url without index.php
Run Code Online (Sandbox Code Playgroud)
如果我删除.htaccess文件,并在网址中公开前端控制器:www.domain.com/index.php/blah/blah/,Chrome就可以正常工作.
有什么想法吗?我认为Chrome识别使用哪种cookie并发送到服务器有什么问题?这发生在Chrome 4和5中.谢谢!
Bry*_*ynJ 17
我有同样的问题,为了解决这个问题,我只需要创建一个favicon.ico并将其放在webroot中 - 否则我可以看到使用Fiddler,因为每次来自Chrome的页面请求都会产生404(尽管我实际上没有链接到页面标记中的favicon).
在我看来,这显然是Chrome中的一个错误,因为缺少favicon应该对会话数据没有影响.
原来问题在于我的.htaccess文件的内容.这解决了这个问题:
#<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymlinks
RewriteEngine on
############################################
## always send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/.*(themes|wysiwyg|images|js)/
############################################
## always send 404 on missing favicon
RewriteRule ^favicon.ico$ favicon.ico [L]
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
RewriteRule .* index.php
#</IfModule>
Run Code Online (Sandbox Code Playgroud)