2011-06-03 70 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] 
相關問題