Stop showing directories

Hello everyone, I just upload my website here it is working fine.
The only problem I face is it allows users to open directories by typing the folder name on the search bar,
for instance:
http://afghanhijab.epizy.com/
Here is the link you can click on the home button and get in,
but someone might come, and type my folders name like http://afghanhijab.epizy.com/config
http://afghanhijab.epizy.com/style and other folders how can I restrict them, if you type a wrong folder you will error 404 which I custom page, if you type correctly then you get all my files. please help me
@Admin, please

try to use directory privacy in cpanel

Thanks for replying, how to do that, I really don’t know please.

Login to cpanel and find directory privacy in files category

You can edit the .htaccess file and add this code to deny access to directories without an index file:
Options -Indexes

2 Likes

choose your domain and click on alter protection

This is what is have on .htaccess and it works fine
ErrorDocument 404 /Error/Error404.php

If I make like this: Options -Indexes 404 /Error/Error404.php

I will get an error, the is this: 500 Error, please check your php script / enable display_errors in your cpanel

If I select on my domain it takes to my main page, there is not another option, can you please upload show me with an image?

Click on alter protection…

Type in the directory which you want to protect.

That’s even worse because it’ll even lock files out

Try this one:

Options -Indexes
ErrorDocument 404 /Error/Error404.php
1 Like

Thank you, this method is working fine, I found another method by creating one index.php or index.html
we can get ride of that now everything is working fine.

But is there any other method to safe us from hackers?

Who is gonna hack our websites though??

No one, but security is necessary, a programmer should take care of all these issues

Oh. Php is not really a thing to be hacked (unlesd you’ve putten security holes in it), unlike frontend codes, php code cannot be viewed on browser, it’s a thing that servet executes.

Even Who you don’t know them, security is important even if nobody wants to hack it.

Nothing is impossible you know.

1 Like

I do agree but still no one is gonna search for our particular website and steal our code

… It’s like you go out without wearning mask and saying I won’t get C19 cuz nobody here has C19 so I won’t wear mask.

1 Like

uh! Okay I understand

@anon77371365 please first see the topic and understand the problem carefully.
He said he need to stop showing directories, not to hide/password protect the directory.
It’s like a CDN to access files, but does not wanna show direct file structure.

:laughing: Agreed.

3 Likes

¯\_(ツ)_/¯

4 Likes