You need to create a .htaccess file in order to block the file access from direct url entry. The below code should work for you.
RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourwebsite\.com/ [NC] RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov) [NC] RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] RewriteRule .*\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov)$ http://yourwebsite.com/ [NC]
There is also a previous post on this in the WordPress Stack exchange on this LINK
The best way to protect uploaded media in WordPress?
Hope that helps.
Andy
Related Posts:
- How to restrict a page [without plugin]
- Restrict access to specific users
- How do we restrict a user to see a field in a post without registration,
- Hide posts of particular category for everyone except of particular user group or role
- How prevent direct access to PDF file
- Disable Page if user not logged in
- Learndash groups content protection with tags
- How can i restrict a page to certain user roles?
- Segregating content in a blog for 2 different readers
- Restrict directory listing to only logged in users
- Restrict content even to specific user
- Member Site – Always Sends Me Back To Login
- I want to restrict a page for subscriber and contributor
- How to stop EU users from accessing my website?
- simple solution for restricting access to (some) uploads/downloads
- Correct Post Count ( All | Published | Drafts | Pending | Trash ) for Custom Post Type when restricting to view own posts
- Loading posts associated only to the logged in user on recent posts page
- Does pre_get_posts affect REST API responses?
- Restrict post edit/delete based on user ID and custom field
- How do I display a user specific content?
- How can I limit functionality in one version of a plugin?
- Hiding posts from non logged in users
- Restrict access to post if it is currently being edited
- Restrict the user access in multi site for non-assigned blogs
- Restrict access to the Trash folder in Posts
- Restrict backend but allow to use post.php?action=delete&post=POSTID from front-end
- Restrict certain posts from being sent to the feed subscribers
- Restrict PDF links
- Limit REST API output to current logged in user that is also author of the content
- WordPress stripping html and script tags from some admin users on save
- Taxonomies, restrict editing and creation of terms?
- Restrict other Admins from using Editor in Admin Panel
- How to restrict the editors from viewing/editing pages created by admin?
- Redirect user to login before viewing custom post
- not logged in users can’t submit form
- Is it possible to restrict viewing of category PAGE to logged in users only?
- Page Restriction and Redirect for Particular Levels or user
- Protect sequence of pages with same password for each of two groups of users
- How can I restrict image upload dimensions for non-admin WordPress users?
- Limit post display to post authors and create an exception for specific pages
- Use an activation code to change a role [closed]
- How to show post content before read more tag (excerpt) for password protected posts?
- How do I log out users from a restricted page if they are already logged in on another device? [closed]
- Are exclusive taxonomy terms possible?
- Remove admin menu
- I restricted wordpress by logged users. It’s possible exclude a page?
- Limit file downloads to logged in users (WP + Nginx)
- How to properly print a 404 error without redirecton? (i.e. keeping the current URL)
- How to allow registered users to submit the form only 5 times per day?
- Get a remote post ID via API given URL
- Restrict content based on buy woocommerce product
- User restricted only show posts assigned to current user
- How to force acceptance of site terms on first login?
- One Site as a part of Multisite to be hidden (Un-published) from Public?
- Restricting page access [closed]
- Downloadable content only for subscribers?
- Hide front-end from every logged out user and redirect them to the default login page
- Restrict the list of parent pages to only those which are created by current user
- Should I setup frontend-only users as CPT or use a plug-in?
- Is it possible to restrict access to specific pages in the admin area based on the page slug?
- How can I lock specific posts (cpt’s) from editing by anyone other than ADMINS
- How can I set a maximum allowed post size and number of posts submitted?
- How can I restrict a custom WordPress role access to only a specific plugin?
- Custom content before post content
- force login loophole
- Simple Math Quiz or Captcha to hide whois query form
- How to restrict a plugin from certain pages without editing its core
- Prevent certain subscribers from seeing specific taxonomies (changes frequently)
- Show/hide posts and categories based on user meta
- Uploading attachment (pdf) and prevent download for anonymous user
- Show content if user left comment / non-logged visitors?
- can you help review CCCP (Conditional Cookie Content Post) and help to create a block?
- create a custom query for posts managed by Restrict Content Pro
- Limit users to specific uploads
- URL Restrictions? Need only people who are logged in AND have a specific role (or roles) to access all pages for a site
- After reading 3 story by user ask for subscription popup
- How can I fetch user registration age
- Restrict access if logged out except for homepage
- How to show private pages based on a user’s role?
- Hide top admin panel for non admin and non editors
- WordPress Front-End user restricted taxonomies
- How to use url formatter with integer
- Restricted images only for logged user. (hidden url)
- Using a page-template to restrict access based on IP (Frontend)
- Front end login and page restriction
- WordPress Shop and restricting products and categories for some users/groups
- Assign specific editor with custom user meta “A” to all authors with custom user meta “A” and exclude all other author access
- Hide page link in main menu from anonymous users
- How to give members access to their own protected page?
- Restrict access to specific content
- Restrict download files from not generated Urls
- Avoid too long words in a post title, post content or comment but only if its not a url
- Basic File/Post restriction plugin
- How do I protect my uploads?
- Premium Members Section of website
- How can visitors redirect wp-admin to the homepage?
- Using Conditional Tags to restrict something to 1 user?
- Multisite Login Access Restrictions
- Restrict Image Sizes and Dimensions when Uploading via the WP Mobile App
- Hide custom posts from certain taxonomy in rest api