I have a use case where users should be redirected but bots and open graph should not be. While I could redirect based on user agent, I was wondering if there were a simpler way, perhaps a protocol which a bot would ignore but a browser would not.

I seem to have a vague recollection of reading of the case where Google indexed a page which included a header with a redirect directive because the page still had content, but I don't know if that would still work or if I am remembering incorrectly.

For clarification, this is roughly the pattern I was contemplating:

Location: /

        <meta property="og:type" content="website" />
        <meta name="twitter:title" property="og:title" itemprop="title name" content="My favorite title" />
        <meta name="twitter:description" property="og:description" itemprop="description" content="huzzah for descriptions" />
        <meta property="og:url" content="http://example.com"/>
        <title>Ducts through the centuries</title>
        This is the body

Is there a way to have Google index the above body while including the redirect header? Will Facebook pickup the open graph tags? What about twitter?

  • In case anyone is wondering the redirect is to a login page because the primary intent of the site is to generate registrations. It is perfectly OK that the response includes all of the content, so long as the user ends up at the registration page. Aug 12, 2015 at 22:26
  • 1
    Redirects in content is BAAAADDDDDD.... and will get you into trouble with search engines. It is an old spammer technique. As well, DO NOT show search engines something different from what you show users. Google and Bing both check your pages from outside of their networks for cloaking which would be what you are doing even if it is not your intent.
    – closetnoc
    Aug 12, 2015 at 22:42

1 Answer 1


What you're doing is not a good idea as it creates cloaking which violates google's webmaster guidelines. On top of that, many modern web browsers will ignore the textual HTML if they come across a Location: header with the proper redirect status code.

The textual HTML in the normal redirect-based pages are there for compatibility reasons. This means if you had a super old web browser that doesn't understand the Location: header, then people will see a redirect message on the screen similar to:


The document has been moved here

...where the word "here" is a link to the new URL of the document.

The only way you could pull your idea off which is something I 100% advise against is to create an endless redirect loop (meaning make the value of location as the current URL). Then if you have apache, the server will quit the redirection after so many times and then output the redirection page. This is bad for the user and search engines.

If you want pages indexed, only index pages people want to see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.