You can create a custom page template for downloads and use something similar to the following:
if (current_user_can('contributor')) {
echo "<h2>Download Page</h2>";
} else {
echo 'You do not have access to this page";
}
You would need additional code to show the file you are offering for download.
Alternatively you could set another cookie and check value of that.
Related Posts:
- Improve wordpress security by hiding non public resources
- Does this .htaccess security setting really work?
- File and directory permissions
- Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021
- WordPress URL/Folder ReWrite using Htaccess
- Which WordPress scripts need to be executable for a fresh installation?
- Blocking access to wp-login via htaccess not working
- Attach to wp-login.php and xmlrpc.php
- XMLRPC filtering through htaccess not working
- Restricting user login by IP address
- WordPress: Adding Security
- How do I test to ensure that my wp-config file is protected?
- WordPress not seeing .htaccess rules
- Rules in .htaccess only if the requested URL is /wp-admin
- Disable directory browsing of uploads folder
- Strange behaviour of is_user_logged_in() and get_current_user_id()
- Selectively Disabling PHP via .htaccess in Root Directory
- Should I prevent access to .htaccess and wp-config.php files?
- Blocking wp-login in HTACCESS has also blocked password protected pages
- Basic Auth .htaccess on wp-login, but allow logout from woocommerce
- Using htaccess to prevent spam through wp-comments-post.php
- How can I create a private site that is inaccessible from the outside?
- Allowing access to certain WordPress created pages or posts with htaccess / htpasswd
- Why is this line of code Wrong in every WordPress .Htaccess security article?
- Change Login URL Without Plugin
- htaccess rewrite conflict with wordpress rules and ssl
- Options for restricting access to wp-admin
- Remove year and month in URL using .htaccess
- Unable to access WP admin
- Move wordpress to folder without changing urls
- Using WordPress only for the backend, and using AngularJS as a frontend
- Two domains on one WordPress Installation
- Protect Upload Folder Files With Ampersand Problem
- .htaccess and WordPress Admin Bar
- How to Redirect huge numbers of URLs to another URLs?
- Struggling with add_rewrite_rule
- Giving WordPress its own subdirectory – nginx
- Cannot mask WordPress page URL using .htaccess
- need a help for modify .htaccess rule [closed]
- How can I make an htaccess file on a Mac? [closed]
- WordPress overrides custom 404 page with it’s own
- New installation can’t be found due to htaccess of the original non-WordPress site
- Fixing custom 404 pages broken by WordPress in a subdirectory
- Case insensitive header params for API request
- I can’t access the admin panel links as I click it shows 403 error
- 301 Redirect domain Sub-folders to Subdomain subfolder
- Drawbacks to using Options -Indexes
- How to hide login form if basic authentication fails?
- Override 404 page with htaccess
- Htaccess Rewrite reverts to default .htaccess file
- what could cause the htaccess file to be modified?
- change permalink structure with htaccess without SEO impact
- How to Change The WordPress Login URL Without Plugin
- .htaccess rules for blocking bots with an extra condition
- Site in subfolder – all pages work except home
- Can’t upload .htaccess after editing in notepad
- Directing subdomain to main domain and keeping the subdomain format with .htaccess
- Remove /sites/25/ from image URLS
- How disable canonical redirect wp-signup
- .htaccess RewriteRule always overwritten – how to prevent?
- Redirect old domain with query paramaters
- Forcing HTTPS with WordPress on AWS
- WordPress Example Code for Blocking Referrer Spam
- How could a .htaccess with authentication suddenly appear or change?
- WordPress .htaccess file gives issues with subdirectory
- W3 Total Cache CSS & JS files GZip issues [closed]
- WP Super Cache unable to locate cache file for only the homepage
- Cannot login to WordPress site after changing .htaccess for security purposes
- WordPress permalink, stop redirection
- How to rename index.php to home.php
- add_rewrite_rule to remove /category/ from permalink
- .htaccess Non-‘www’ to ‘www’ Subdomain Redirection Only Works for Homepage
- Non WordPress Folder in a WordPress Site
- Htaccess rewrite based on query string, not working [closed]
- Redirect all subdomains to root domain
- Change root directory
- .htaccess redirect not properly working [ ?utm_source=]
- How to execute WordPress as though it is in the root folder while it is installed in a subdirectory?
- Htaccess maintenance page rules that actually work with WordPress?
- How to allow only vpn access to dashboard on Bitnami WordPress by IP address restricting
- htaccess redirect to path
- Iterating users while user iteration is suppressed
- Non-wordpress subdomain on Multisite Installation
- Unable leverage Browser Caching on AWS Bitnami stack (Apache) through W3TC and Cloudfront CDN
- Downloading zip or tar.gz inside WordPress installation?
- Rewrite rules and maintain URL
- Subfolder renaming
- Targeting .htaccess file with file_put_contents
- Redirect Loop in Regex Moving to HTTPS
- .htaccess file changes disappear
- WordPress login bug. Need an emergency solution
- .htaccess and virtual host configuration for WP in its own directory
- Issue after changing permalink structure [duplicate]
- rewrite rule on plugin activation
- Url redirection using htacess for my website
- htaccess – Server Subdirectory With Different Name Than URL Subdirectory
- Hardening WordPress – how to set .htaccess permissions?
- FilesMatch in htaccess
- Interaction of .htaccess, WP_HOME, and WP_SITEURL
- malware affecting backend of wordpress website-could be .htaccess file