Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"simple" question re. .htaccess

Status
Not open for further replies.

roeiboot

Technical User
Feb 10, 2002
241
US
(well, i guess -hope- it's simple for you guys :}

oi~

couldn't find it (yet) mainly because i'm not sure what to search for.. i want visitors to be unable to browse some directories using .htaccess but when i put one in for example the graphics dir the images on the web site are missing :}

how to solve please ?

thanks
 
Hi

Personally I did not understood too much from your question.
[ol]
[li]What is in your .htaccess file ?[/li]
[li]What files you want to serve for who ?[/li]
[li]What files you want to restrict from who ?[/li]
[/ol]

Feherke.
 
I presume that you're asking how to prevent users from directly accessing your graphics directory? If i'm correct, this must mean that directory indexing is enabled. So, the only thing that you'll need in your .htacces file for that directory is:

AllowOverride all
Options -Indexes
 
smah had it correct about what the question was... but i tried that and it doesn't work (my host runs Apache/1.3.31 if that matters).

so i want to "protect" my directories but i do want to have files accessible like my graphics, when i put what smah says in my .htaccess i get a error 500 Internal Server Error.
 
Sorry, my mistake. AllowOverride is not needed. So the only directive that your .htaccess needs is:

Options -Indexes
 
I should also mention that there is an alternative. You could create an index.html file in your graphics directory that looks like an error message then refreshes back to your home page.
 
smah; you're my hero, i like the second option to redirect them back.. a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top