Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

How to secure files based on format and word in file name with wp-config or htaccess?

This is not quite trivial, because natively WP is engineered to completely ignore requests to existing files. So WP doesn’t pay attention to files and .htaccess doesn’t have access to WP’s logged in information.

If you look for prior art (in plugins for selling digital files for example) this isn’t easily (at all?) doable with direct links. Typically special download links are created and processed by plugins to serve files while masking it’s true name/location (which should be restricted from direct access or not in web accessible folder at all).

Related Posts:

  1. Login page ERROR: Cookies are blocked due to unexpected output
  2. Block Logged-Out User Access to Directory Outside of WordPress using .htaccess and PHP file
  3. How to edit .htaccess to change site’s login url?
  4. deny IPs from wp-login using .htaccess
  5. 404 redirect wp-login and wp-admin after changing login url [closed]
  6. How do I limit access to wp-admin to an IP range?
  7. Login failed after cloning live wordpress site to local wampserver
  8. After moving WordPress to its own directory, login doesn’t work
  9. In Django, how do I know the currently logged-in user?
  10. Can I programmatically login a user without a password?
  11. Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
  12. Is there any way to rename or hide wp-login.php?
  13. How to login with email only no username?
  14. How can I redirect user after entering wrong password?
  15. Site Redirecting to wp-signup.php
  16. Moving a WP Multisite to a subdirectory
  17. Increase of failed login attempts, brute force attacks? [closed]
  18. Separate registration and login for different roles
  19. SSO / authentication integration with external ‘directory service’
  20. Preventing session timeout
  21. How reduce wordpress login session timeout time?
  22. How to prefill WordPress registration with social details
  23. Check for correct username on custom login form
  24. Disallow user from editing their own profile information
  25. Which one does WordPress prioritize when it comes to php.ini, wp-config and .htaccess?
  26. I can’t access my site via wp-admin
  27. ‘Password field is empty’ error when using autofill in Chrome
  28. Removing username from the ‘wordpress_logged_in’ cookie
  29. How to show ‘login error’ and ‘lost password’ on my template page?
  30. What is $interim_login?
  31. Custom login form
  32. How to prefill the username/password fields on the login page
  33. wp_signon returns user, but the user is not logged in
  34. Adding extra authentication field in login page
  35. Prevent wp_login_form() from redirecting to wp-admin when there are errors
  36. Redirect user using the ‘wp_login_failed’ action hook if the error is ’empty_username’ or ’empty_password’
  37. wp_signon() does not authenticate user guidance needed
  38. What exactly is ReAuth?
  39. What are the differences between wp_users and wp_usermeta tables?
  40. Login members using web services
  41. Make my wordpress blog remember my login “forever”
  42. How to check in timber if user is loggedin?
  43. How do I change the language of only the login page?
  44. multisite 404 error for subdirectory
  45. Disable WordPress 3.6 idle logout / login modal window / session expiration
  46. Stop WordPress from logging me out (need to keep me logged in)
  47. Woocommerce registration page [closed]
  48. How to disable autocomplete on the wp-login.php page
  49. Share login data/cookies between multiple installations
  50. Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU
  51. How to pass users back and forth using session data?
  52. How do I change the logo on the login page?
  53. Move WordPress to subdirectory, keep ALL URLs
  54. Why does WordPress hide the reset password key from the URL?
  55. Is it possible to sign in with user_email in WordPress?
  56. How to use current_user_can()?
  57. Avoid to load default WP styles in login screen
  58. WordPress registration message
  59. How to fake a WordPress login?
  60. how to display the wordpress login and register forms on a page?
  61. WP-Admin not working properly at WordPress multisite with subdirectories
  62. Does wp_logout_url() destroy a session? (Logging out question)
  63. How can I send a welcome email to a user AFTER they login for the first time?
  64. Can not login with correct username and password
  65. Website Visible only to Registered users
  66. How can i increase the login expiration length?
  67. How do I use add_action from a class method?
  68. How to remove the WordPress logo from login and register page?
  69. How can I add a custom script to footer of login page?
  70. Brute force attack?
  71. Customize wp_new_user_notification_email()
  72. Need to execute a cron job
  73. Permalink Issues by Installing WordPress in Subdirectory / Subfolder
  74. Login email after registration never sent or received
  75. How can I create a separate blog that is private?
  76. How to keep always logged in development environment
  77. Add Confirm Password field in wp-login.php Password Reset page
  78. Integrate recaptcha and wp_signon – what is needed?
  79. Stop users from logging in from multiple locations
  80. I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
  81. custom login page redirect to logged in user profile page
  82. WordPress multisite subdirectory redirect infinite loop issue
  83. Email address or username used to login in wordpress
  84. How do I check if a post is private?
  85. Front-end login: Redirect user to the post they had created
  86. Receiving “This content cannot be displayed in a frame” error on login page
  87. My login form does not work
  88. Programmatically log in a wordpress user
  89. Action wp_login_failed not working if only one field is filled out
  90. Getting “Cookies are blocked or not supported by your browser” on login page
  91. What is the purpose of logging out after WordPress upgrade?
  92. Is it alright for two people to simultaneously be logged into a WP site as administrator?
  93. wp-login.php redirecting to HTTPS
  94. Display last login time
  95. How to customise wp-login.php only for users who are setting a password for the first time?
  96. Intentionally Force Failed Login WordPress
  97. How do I turn off the ability to login?
  98. Gaining Login Access via the Database
  99. Admin-Ajax.php, SSL, Non-SSL
  100. How to Block Access to Standard Login Flow and Comment Flow
Categories login Tags .htaccess, login, wp-config
Show error message after exception handled
How to exclude certain files from the plugin editor?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress