.htaccess to restrict access to directories

They have: 426 posts

Joined: Feb 2005

HI
I have a website and you can directly navigate to a directory and it will list all the files.

I need a .htaccess file to restrict the access (i think) but i keep finding information about password protecting the directory. I dont want to do that just avoid any access at all only include the files?

Can anyone help me.

Thanks.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Add this to your .htaccess file in the specific directory you want to limit access to:

Options -Indexes

They have: 426 posts

Joined: Feb 2005

Hi,

Thanks - perfect!

They have: 426 posts

Joined: Feb 2005

Hi

although this restricts file listing i can still go directly to the file in the browser?

How can i stop from directly accessing this. i only want to include this.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

What types of files are in that directory?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.