私は会社の新しい Web サイトを開発しているので、サイトをインターネットに公開しましたが、.htaccess による特定の IP アドレスへのアクセスを制限しました。
ただし、新しいサイトの一部には「Facebook で共有」ボタンがあるため、それをテストする必要がありますが、Facebook は私のサイトに接続できず、これは OpenGraph のタイトル、説明、画像などを取得していません。
.htaccess に追加allow from facebook.com
しましたが、これが機能せず、接続しようとするとFacebook リンターが 403 を報告します。サイトへのアクセス制限を一時的に解除すると、Facebook リンターが接続できるようになります。
これが私の完全な.htaccessファイルです(実際のIPアドレスを差し引いたもの)-
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's 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>