how to hide Access to media files in a directory, if we have the full URL for a file. How to, I make an online store, so to download one of the files in my store, I have to log in first, then it can be downloaded, for example https://mystore.com/product/widia/ they must log in first, but if we access it from the url of the file, for example https://mystore.com/wp-content/uploads/2019/01/widia.ttf then the file is downloaded immediately, Please help
Just in general.....
index.html file in the directory. Leave this index file completely blank (no markup or text whatsoever - although you can style it or add content if you desire).
When a user targets the URL the index.html file is called an they merely see a blank page (or the content of the index.html file).
This does not prevent direct access to items within the directory if the full path and file name is known. However, it does prevent "browsing" of the directory itself.
I place a blank index file in every directory which is not meant to be viewed by anyone over the web - even if the access is limited via server configurations. The blank file hurts nothing if it is not necessary, but will prevent browsing if it is needed.
If this is a "store" and you are selling items in a directory and want to prevent access to those files, even if the file path is known, you need much more robust protection via some server-side scripting (php/asp) and authentication to control the access to downloads. It's not an easy answer especially if you aren't familiar with server-side scripting.
In general you'd probably set an authorization cookie after purchase. When the user accesses the download directory, the cookie is checked to see if it is valid. If the cookie is not valid, has timed out, or is simply not present, the user is rejected from the directory and unable to download.
StackOverflow.com is site in the stack network more directed at web site configuration, creation, and assistance with those matters. this stack isn't really geared towards assisting with server-side scripting.