How to Hide and protect all Website directory from hackers through index file or command

wordpress secure directories

You can Hide or protect your website directory through index file from hackers easily or you can use commands also. now a days its common that hackers find a loop hole in a site. an its possible that they can find a way to reach to your database by checking your directory files.

there are some plugins in wordpress in which directories are not having index files and also it happens with theme files. so any user can directly access that folder and see what content and plugins you have. example is in picture


their are 2 methods first one is very difficult and second one is very easy. First is you need to put empty index.php or index.html file in every empty folder that dont have this file and this is difficult work because their could bhi hundreds of folders and subfolders in a website.

you can do it through filezilla or through cpanel but it will take a lot of your time. second method is you can add a simple line in htaccess file of your website which in present in public html folder or where you installed the website.

if you are using Linux server then click on file manager and click on show hidden files so you can see the hidden htaccess file on home. open it and add

Options -Indexes

Now you are done and your wordpress or other websites are secure. see ya