2014-01-21 30 views
0

我需要使用mod_rewrite創建一個Cookie。在這裏找到需要的標誌;使用mod_rewrite失敗創建Cookie

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

在我的虛擬主機配置文件用於這一點,但沒有餅乾設置。我找到了一些例子,但沒有一個適用於我的服務器。

因爲我想,也許在虛擬主機是創造一個問題,我添加了以下配置一個htaccess文件:

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

再次,沒有Cookie設置。 RewriteRule匹配,但沒有創建cookie。

請幫忙!

編輯:阿帕奇v2.2

回答

0

我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 

正如您所看到的標題已發送,但由於域不匹配,瀏覽器不接受它。