2011-06-03 36 views
1

我想创建一个HTACCESS重定向,它检查文件和cookie是否存在。它需要检查以下...如何创建一个.htaccess查询来检查文件和cookie是否存在?

If a cookie called "my-cookie" does NOT exists 
AND a file in the "/cached/" folder exists with the same name as the REQUEST_FILENAME 
THEN load the file from the "cached" folder. 

也有可能这将是很好用“。”替换“/”。在REQUEST_FILENAME中。

回答

1

沿东西这个线应该让你在路上:

RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_COOKIE} !^.*cookie-name.*$ [NC] 
RewriteCond cached/%{REQUEST_FILENAME} -f 
RewriteRule (.*) cached/%{REQUEST_FILENAME}/ [L] 
相关问题