I have a .htaccess RewriteRule that redirects users to /coming_soon/ if they do not have a dev cookie, but for some reason it’s redirecting me even if I do have the cookie. This rule was working correctly last night until I added another condition to allow requests to my Google Webmaster Tools verification file to go through. Here are the contents of my .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_COOKIE} !^\dev=$ [NC]
RewriteCond %{REQUEST_URI} !/google********.html
RewriteRule ^(.*)$ coming_soon [QSA,L]
To be honest I don’t really understand the syntax of RewriteRules and most of these I just scavenged from the internet, which is making it really hard to debug.
I set the cookie locally and verified it exists, so does anyone know what I’m doing wrong?
You have a stray backslash:
That makes it so it’s expecting a digit there instead of a “d”.
Also note that this only works if there is only 1 cookie and it is exactly
dev=. You may want to broaden it a bit by changing the regex to: