0

I've got a drupal front_page that reditects all anonymous users from blogs to front page. But I want to facebook clawler see my og: data, to post comments with current title. Facebook crawler got 302 on front and takes title from front page.

How can I do a (maybe) whitelist to facebook crawler to take og: data from restricted area?

1

I am not sure how you are doing the redirect, but Facebook sends a USER AGENT string to signal its bot/crawler, so you could do something like:

  if (strpos($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit')!==FALSE) {
    // DON'T REDIRECT, we're facebook crawling around...
  } else {
    // REDIRECT, we are another bot or a user, etc...
  }
| improve this answer | |
1

It depends on way how you made the redirection. Rules? Then add condition that tests user-agent and identify if it is not FB crawler. If you don't like PHP snippets you can do it by check Context which tests user-agent.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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