How do I hide my website’s the log files from users who aren’t me?

My website has a couple logs including an error log, email log, etc. I already made it so that they can be accessed only if reached through a link on the website (using RewriteEngine in .htaccess), but technically, if someone knew the URL path, they could just create an anchor tag in the browser’s “Inspect element” mode and access the file. I also tried prefacing the log file with some php code that checks if user is logged in and if it’s me, but it just gets parsed as text.

How can I make the logs inaccessible by anyone who isn’t me?