Allow Facebook to access my site so it can read OpenGraph meta tags

I am developing a new website for our company, so I put the site on the internet but restricted access via .htaccess to specific IP addresses.

However, part of the new site is the Share on Facebook button, so I need to check this, but Facebook can't connect to my site and it doesn't capture titles, descriptions, images, etc. OpenGraph ..

I added allow from facebook.com

in .htaccess but it doesn't work and Facebook linter reports 403 when trying to connect. Temporaraly, which removes site restrictions, allows the Facebook linker to connect.

Here is my complete .htaccess file (minus real IPs) -

ErrorDocument 404 /index.php?error=404

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# Only allow access to the site from the IP listed below
#order deny,allow
allow from 1.2.3.1 # sh_adsl
allow from 1.2.3.2 #sh_lease_lines
allow from 1.3.1.1 # sh
allow from 1.2.2.1 # sm
allow from 1.2.3.1 # wi
allow from 1.2.4.1 # fr
allow from 4.3.2.1 # dgard -  home local range
allow from facebook.com # to allow the Facebook sharing
#allow from all
deny from all

# Block access to wp-config.php
<Files wp-config.php>
    order allow,deny
    deny from all
</Files>

# Deny directory browsing
Options All -Indexes

# Prevent access to any file that begins with '.hta' (i.e. protect this file!)
<Files ~ "^.*\.([Hh][Tt][Aa])">
    order allow,deny
    deny from all
    satisfy all
</Files>

      

+3


source to share


1 answer


FB Scanner IP List: https://developers.facebook.com/docs/ApplicationSecurity/#facebook_scraper



Add them to .htaccess

yours and you should be good to go.

+3


source







All Articles