Jump to content

.htaccess


asmith

Recommended Posts

i have a folder name "files" . i want to forbid the access to it  ,i mean if someone type in the address bar : 

 

www.domain/part1/files/

 

 

it gave him error .

as i read somewhere else on this forum , i made an .htaccess file , with no content but "Options -Indexes".

i put that in files folder, but when i type the address, it still shows me the content of the folder, what thing i'm doing wrong ?

Link to comment
Share on other sites

Options -Indexes will not show the file list if you access the folder. I.e. http://example.com/folder will give a 403 Forbidden error but files can still be access, i.e. http://example.com/folder/file.ext will show.

 

Deny From All will give a 403 Forbidden error on both file listings and files.

 

 

So, if you want to hide the file listing but allow users to access the files use the former, if you wish to deny ALL access to all files use the latter.

 

 

In order to use the former in a .htaccess file placed in the folder you wish the settings to have effect on AllowOverride Options must be set. For the latter AllowOverride Limit must be set. You can also set AllowOverride All which will enable all directives in .htaccess files.

 

You can also put it in your httpd.conf file, but in order for this to work only on the folder you wish you use enclose it with <Location /path/to/folder> (path is relative to document root) and </Location>.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.