So I am looking for a system which essentially returns a 401 for every visitor that doesn't have a certain cookie. I would like to make it so if the visitor/requester is google then it does not return the 401.
So here is the following code that I have, and it does not seem to be working but I am not sure why.
Basically, I have it check for the cookie and then check if it isn't google via user agents.
If both are true then it will return 401.
The probably seems to be that google is still getting a 401 when I fetch my website via web master tools.