Created
January 12, 2025 03:38
-
-
Save sadiqsalau/8fcee7b5faf9a1f8d25767e581972ab9 to your computer and use it in GitHub Desktop.
Redirect Crawlers to Backend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options -MultiViews | |
RewriteEngine On | |
# Enable Https | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Twitterbot|Pinterest|Google.*snippet|LinkedInBot|Slackbot|Discordbot|WhatsApp|TelegramBot|Applebot|Bingbot|YandexBot|DuckDuckGo-Favicons-Bot|Sogou|Exabot|Baiduspider|SeznamBot|ahrefsbot|MJ12bot|DotBot|ia_archiver|Embedly|W3C_Validator) [NC] | |
RewriteRule ^(.*)$ https://backend.example.com/og/$1 [L,R=301] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^ index.html [QSA,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment