1

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.

1 Answers1

1

This is known as cloaking and will get your site delisted from Google if they catch you doing it.

https://support.google.com/webmasters/answer/66355?hl=en

Cloaking refers to the practice of presenting different content or URLs to human users and search engines. Cloaking is considered a violation of Google’s Webmaster Guidelines because it provides our users with different results than they expected.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105
  • The 401 will present a browser verification page that will set the users cookie to the verified one. At which point the user will be able to access the original content. This is not cloaking, almost every CDN in the world has this same technology. This is also not an answer, this is a comment so please delete it as such. – Eddie Chrisman Feb 24 '16 at 00:49
  • 1
    @EddieChrisman Have you actually tested this yet? In every browser I know of, if you send a 401, the browser will ask the user to enter a username and password. – Michael Hampton Feb 24 '16 at 01:00