Missing Open Graph Images? Remove Image Hotlinking!

Ciprian on Tuesday, February 14, 2023 in WordPress

NEW! Learn JavaScript by example. Code snippets, how-to's and tutorials. Try now!

I have just found out that my image hotlinking solution was preventing social networks from reading my Open Graph image tags. Pretty silly.

I had these lines in my .htaccess file:

# Prevent image hotlinking
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?getbutterfly.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?codecanyon.net [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?themeforest.net [NC]
RewriteRule \.(jpg|jpeg|png|gif|webp|mp4)$ - [NC,F,L]

Notice how I only allow specific hosts from accessing my images and my media content.

Luckily, a recent update to W3P SEO helped me discover this issue. After removing the lines above, the images started appearing again on all social networks. I need to re-share, re-post, re-tweet everything again now, just so I can show off my featured images.

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *