Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript htaccess无法在Firefox中读取Cookie_Javascript_Php_.htaccess_Firefox_Cookies - Fatal编程技术网

Javascript htaccess无法在Firefox中读取Cookie

Javascript htaccess无法在Firefox中读取Cookie,javascript,php,.htaccess,firefox,cookies,Javascript,Php,.htaccess,Firefox,Cookies,我在.htaccess文件中有以下代码,在Firefox25中不起作用。它可以与Chrome(即Safari)配合使用 Header unset Cache-Control Header append Cache-Control "no-cache, must-revalidate" RewriteEngine on RewriteCond %{HTTP_COOKIE} !^.*userloggedin.*$[OR] RewriteCond %{HTTP_COOKIE} userloggedin

我在.htaccess文件中有以下代码,在Firefox25中不起作用。它可以与Chrome(即Safari)配合使用

Header unset Cache-Control
Header append Cache-Control "no-cache, must-revalidate"
RewriteEngine on
RewriteCond %{HTTP_COOKIE} !^.*userloggedin.*$[OR]
RewriteCond %{HTTP_COOKIE} userloggedin=x
RewriteRule .* http://www.bostonneca.org/redir.php
我使用代码检查是否设置了cookie。如果未设置,则将用户重定向到登录页面。登录后,用户可以访问该文件夹

setcookie('userloggedin', 'ok', time() + 60 * 60 * 5);
我猜这是服务器问题,因为我无法使用setcookie('userloggedin','',time()-1)删除cookie; 为了避免这个问题,我在注销时写了一个cookie

setcookie('userloggedin', 'x', time() + 60 * 60 * 5);
请帮忙

谢谢, Adrian调试帮助:

FireBug/控制台-如果设置并发送cookie,请查看标题

重写日志-查找重写的错误配置

通过以下方式启用:

RewriteLog /tmp/rewrite.log
RewriteLogLevel 3
(建议为3级调试)

另见这个问题:


或者,您可以在index.PHP或正在加载的任何文件中使用PHP测试cookie,或者,您可以将每个请求重定向到
redir.PHP
并检查此文件中的cookie。

您是否查看了
RewriteLog
输出以及FireBug或控制台中的标题?您可以处理所有cookie内容而无需重写。在Firebug中,cookie已设置(请查看屏幕截图),但在htaccess与Firefox的组合中,cookie不可见。我无权查看重写日志…感谢您花时间帮助我。我很感激。重写日志在服务器上不起作用(内部服务器错误),因此我更改了代码以通过php显示私有内容。