• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

mod rewrite with cookie

Could you help me with a mod rewrite rule with that allows access to a file if they have a certain value for a certain cookie and doesn't allow if they don't have it.  thanks
1 Solution
# check for existence of the cookie, before allowing download
RewriteCond %{HTTP_COOKIE} (?!SomeCookie=.+)  
RedirectRule ^/location/.*  /denied.php?loc=$0      [L]

This will redirect /location/* to /denied.php?loc=/location/*   if SomeCookie is not present

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now