You need to edit .htaccess file and add following line right after current lines. You can edit the file from cpanel or FTP. Also there is a WordPress Plugin that allows to edit .htaccess file.
Remember it’s a very advanced thing to do. So make sure to backup current file before editing. Any error will cause site not loading.
/* Prevent image hotlinking in WordPress */
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourwebsite.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?facebook.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?twitter.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [F]
This will let only youtube, google, facebook and twitter to directly Link you images. All other websites will be blocked.
Related Posts:
- Clicks registering on Preview DNS site
- How do I get the avatar URL instead of an HTML IMG tag when using get_avatar?
- Programmatically get images by URL and save in uploads folder
- Function to get URL of original uploaded image – full size
- Is there a simple way to just insert a link to an image (without inserting an image)?
- How to reference a theme image in a stylesheet?
- Mixed content warnings after changing site adress from HTTP to HTTPS
- Default Image Link Removal
- Preview Image Path in Admin Section
- How to add a link in a image’s caption?
- Change website URL without breaking links or images? WP 3.3
- Why would image paths in wordpress suddenly change?
- how to grab first link in post… and of course call it
- How to remove link from an image in a post?
- Remove the http protocol from images
- How do i reference the theme path in pages for images?
- @wordpress/create-block image url in css
- Remove ‘wp-content/themes/themename/’ from Image path
- WordPress url image redirect to the homepage
- Broken urls with http site and https wp-admin
- A way to change image urls in post to cdn image url?
- How to change image url?
- Update image links in database
- Shortcode for a link and thumbnail
- media_sideload_image with rewritten urls?
- All Images on wordpress site broken
- Move Image Captions Inside Link ( tag) if Added
- Is it possible to change ‘Link to’ in all images in all articles?
- Help With Custom Image and Text Widget
- How to add an image to a custom url?
- How to filter the image embed code based on link type
- images not showing after transfer
- I am getting useless alphabets in images link
- Change media URL (images)
- Add clickable link on an image
- How to redirect homepage to actual URL?
- How do I link a featured photo to it’s post?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Using a .pdf file as a page in wordpress
- How to get image URL from media_sideload_image?
- Disable Media File Image Link On Mobile Devices
- Exclude image url from search query
- Redirect Image Url to a page via htaccess
- How to pass on a value as parameter via url to another page
- Hiding Media Source Links
- Link to full-size image for subscriber only
- How to replace post image url before posting using api?
- Hide or mask the url to an image
- Link to products with the same image title (woocommerce)
- Glitched page redirects to image
- i want to change URL of WordPress image or rewrite in runtime
- link not working in image section
- Recovered WordPress installation (on localhost) links broken and images not showing
- WordPress 404 Images – Images not found after deleted from media
- Image linking and lightbox
- Server peek by Own-IP-Calls?
- Bypass wp_safe_remote_get()?
- Which tools should I use for a gallery that uses an API and url for the path of the images?
- List sub pages with custom field content converting image ID to URL
- How might one programmatically set the link for all images in all posts?
- Images not showing after moving site
- Change the image for a certain URL
- Surround uploaded image link with div
- Setting name of attachment URL
- Search and replace image urls in posts
- Protocol relative url not pulling up images on IE, FF, and OPERA
- Making a thumbnail if there exist a link with. jpg or .png extension in WordPress
- Broken image URL
- How do I mitigate the forward slash problem for URLs of images after a WP migration?
- Images in sub-pages fail to load
- adding images to wordpress pagination?
- get_post_custom: get image URL instead of image ID
- Are image addresses security relevant?
- Stop underlining image links
- Remote Image (from URL) as Media Library element
- WPALLIMPORT Exporting images from repeater field [closed]
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- get the attachement url for the medium sized image
- Black and White thumbnails
- Download button for Featured Image in every post – automatically
- Add attribute to caption shortcode from custom attachment field
- Get an image’s alt text in a shortcode using the image URL
- Character Limit w/ Excerpt removes Images Why?
- Faster way to put images into a blog post by using Add Media dialog
- Native gallery sorting is ignored
- What can i do add title to ‘large’ image?
- How to set minimum required size for featured image?
- Image “description” and SEO within WP
- Family collaboration to identify ancestors on pictures
- How do you obtain a list of all image file names on a wordpress website for replacement?
- Form File Upload Field generates multiple copies of Image Files (different sizes): Is this a WP feature or is this being done by the Plugin
- Responsive header image
- Get “Image CSS Class” value from the Advanced Options section
- After reinstalling wordpress images do not appear in posts?
- How can I use images that are on the server locally?
- Image filter works on attachement pages but not posts. I can’t get the image ID
- Get images uploaded to this post in popup on editor screen
- How do I add a nested conditional within an echo – to use a default image if there isn’t one in the post?
- How to give path to image in wordpress?
- Edit multiple posts featured image