Skip to content

Instantly share code, notes, and snippets.

@brianjeremy
Last active February 28, 2020 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjeremy/18d2f0c9eb742746f875 to your computer and use it in GitHub Desktop.
Save brianjeremy/18d2f0c9eb742746f875 to your computer and use it in GitHub Desktop.
Sample .htaccess file that will allow Facebook and Pinterest to bypass authorization so you can keep your site private to the public yet properly test social sharing
# look for Facebot/facebookexternalhit (1.0/1.1)
SetEnvIfNoCase User-Agent .*faceb.* noauth=1
# look for Pinterest (0.1/0.2)
SetEnvIfNoCase User-Agent .*pinterest.* noauth=1
# auth
AuthType Basic
AuthName "PRIVATE"
AuthUserFile /var/www/path-to-your-virtual-host/.htpasswd
Order Deny,Allow
Satisfy any
Deny from all
Require valid-user
Allow from env=noauth
@Gugiman
Copy link

Gugiman commented Feb 28, 2020

Thanks bro :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment