Created
August 29, 2017 07:57
-
-
Save yasuhiro-matsuda/fc87420f473796158672e829433c8851 to your computer and use it in GitHub Desktop.
SNSクローラーかBasic認証OKで通過させる apache 2.4
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
# SNSクローラーをenvに設定 | |
SetEnvIf User-Agent ^facebookexternalhit.*$ fb_crawler | |
SetEnvIf User-Agent ^facebookplatform.*$ fb_crawler | |
SetEnvIf User-Agent ^Twitterbot.*$ tw_crawler | |
# どれか一致で通過 | |
<RequireAny> | |
# クローラー | |
Require env fb_crawler | |
Require env tw_crawler | |
# Basic認証 | |
AuthUserFile /var/www/html/.htpasswd | |
AuthGroupFile /dev/null | |
AuthName "Please enter your ID and password" | |
AuthType Basic | |
require valid-user | |
</RequireAny> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment