One option would be to move the log file outside the web root so that it’s not accessible to site visitors. For example, if the file is currently at /home/example/public_html/log.txt
, you could move it to /home/example/custom-logs/log.txt
. The plugin cannot do this automatically. You would need to move the file manually and change the log file path in the code that enables error logging.
Another option is to block access to the file using .htaccess
rules. If you use the automatic setup feature in Error Log Monitor, the plugin already tries to do this for you. The elm-error-logs
directory that it creates should have a .htaccess
file that blocks access to all files in that directory. However, I’m not sure that WordPress can detect that kind of a .htaccess
block – it might still think that the file is public even if access is blocked. I think moving the file to a place outside the directory that contains website files would be move reliable.