Create htaccess infinite redirection to random URLs to prevent Facebook crawling

Create htaccess infinite redirection to random URLs to prevent Facebook crawling - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Create htaccess infinite redirection to random URLs to prevent Facebook crawling error on your web browser. Problem :


I want make an infinite series of 302 redirects. For example:




  • Visitor accesses example.com

  • Which 302 redirects to example.com/abc

  • Which 302 redirects toexample.com/xzy

  • Which 302 redirects to example.com/ghi

  • ... etc in an infinite loop with random URLs until timeout



I don't want Facebook bot to crawl my site. If I try to prevent it in the normal way, Facebook will still scrape text and images from my website. When my site is shared frequently on Facebook, I want my website to be blocked. If Facebook bot is stuck in redirect, it can not scrape my site.


Solution :


i want to make infinite redirection because i dont want facebook bot crawl my site. if do in the normal way, the facebook also trace my website, and when I share in highly frequency mysite on facebook then my website will be blocked. if make facebook bot stuck in redirect it can not trace mysite – Sheng Long




That tactic'll work perfectly, if you want to kill your server. Simply put, their hardware won't even sweat and yours will give in and fail.



This is security through obscurity, which is not security. Please don't implement his, or similar ideas, ever.



You're apperantly looking for a work-around for Facebooks spam checks, for which I will not provide a better solution, sorry.



Check out the API tools, post via those, to a max of that limit. I don;t know how many posts you make, but I don't think you're using Facebook as is entended.




I tried to add this into .htaccess file:



RewriteEngine On
RewriteCond %HTTP_USER_AGENT (facebookexternalhit|FacebookExternalHit|Facebot) [NC]
RewriteRule ^(.*)$ ^$1 [R=302]



As already stated you don't "redirect", and certainly don't try to create an "infinite redirect", in order to block traffic. Purposefully creating an "infinite redirect" for any day-to-day webmastering is nonsensical.



Using robots.txt to block Facebook is probably the recommended way, but you mentioned in a comment on the duplicate question that you didn't want to use robots.txt for some reason.



So, based on your attempt, to block Facebook in .htaccess, the following should be sufficient:



RewriteEngine On
RewriteCond %HTTP_USER_AGENT (facebookexternalhit|facebot) [NC]
RewriteRule ^ - [F]


This will return a "403 Forbidden" for all requests where the user agent contains either facebookexternalhit or facebot (NC - not case-sensitive).



Reference:

The Facebook Crawler - User Agents




in an infinite loop with random URLs until timeout




Just for info, this is probably not done in .htaccess. Apache config (ie. .htaccess) does not do "random".


We hope that this article has helped you resolve the htaccess, redirects, error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How do I redirect traffic only if being accessed from a specific port?

DNS entry to redirect constant url to changing directory name

How to redirect to any domain [duplicate]