【问题标题】:Cookie creation using mod_rewrite failure使用 mod_rewrite 创建 Cookie 失败
【发布时间】:2014-02-11 20:04:18
【问题描述】:

我需要使用 mod_rewrite 创建一个 Cookie。在这里找到了需要的标志;

http://httpd.apache.org/docs/current/rewrite/flags.html

在我的虚拟主机配置文件中使用了这个,但没有设置 cookie。我找到了一些示例,但它们都不适用于我的服务。

由于我认为可能是虚拟主机造成了问题,因此我添加了一个具有以下配置的 htaccess 文件:

RewriteEngine On
RewriteRule .* - [CO=frontdoor:yes:.perfil.com:1440:/]

再一次,没有设置 cookie。 RewriteRule 匹配,但没有创建 cookie。

请帮忙!

编辑:apache v2.2

【问题讨论】:

    标签: apache .htaccess mod-rewrite cookies


    【解决方案1】:

    我 99% 确定,您的域名拼写错误。

    # curl -I http://somedomain.dev/q/more-stuff
    HTTP/1.1 404 Not Found
    Date: Wed, 22 Jan 2014 01:41:42 GMT
    Server: Apache/2.2.22 (FreeBSD) PHP/5.4.11
    Set-Cookie: frontdoor=yes; path=/; domain=.perfil.com; expires=Thu, 23-Jan-2014 01:41:42 GMT
    Content-Type: text/html; charset=iso-8859-1
    

    如您所见,标头已发送,但由于域不匹配,浏览器不接受它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-23
      • 1970-01-01
      • 2013-08-31
      • 1970-01-01
      • 2020-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多