Good, I have a problem, I am making a page and when entering a directory, it loads a page which shows all the files or directories that the current directory contains.
How can I redirect the user to the home page and prevent the user from viewing the contents of the directory or entering directories?
I'm going to assume you're using Apache as your web server (keeping in mind that you're using an .htaccess file), add this to your .htaccess file in your website's public root folder: