Score:0

htaccess cookie block only blocks static assets

gb flag

I'm putting together a solution to block access to some lower environments with a 404 in the absence of a particular cookie. This is a Drupal site and what I'm finding is that, without the cookie, static assets get 404'd, but the actual php content loads - it just looks ugly, of course.

I'm not seeing anything obvious and it's been a lot of years since I worked with Apache+PHP, so I'm hoping someone here can point me in the right direction.

# htaccess Snippet
RewriteEngine On
RewriteCond %{HTTP_COOKIE} !mycookie=cookievalue; [NC]
RewriteRule ^ -[R=404,L]

What I really want is for a missing/invalid cookie to be a full stop that just throws up the generic Apache 404 page and does no further processing.

Thoughts?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.