Block Directory using .htaccess

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
RTWNick
New to forums
New to forums
Posts: 7
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Fri Mar 07, 2014 5:05 pm

Block Directory using .htaccess

Post by RTWNick »

I did manage to do this before, but then the user could not see any CSS styling as it blocked the user from seeing any CSS. I am trying to figure out how I can block asset directories such as /css, /img, /js, ect. Anyone know of a way of doing this with a .htaccess or another method that results in a 403 error?
User avatar
kraze
Former staff
Former staff
Posts: 4362
Joined: Fri Sep 17, 2010 9:06 am
Location: California

Re: Block Directory using .htaccess

Post by kraze »

There are a few ways you could do this, but the easiest would be to create a blank index.html file and place it in that directory.

If you wanted to strictly due this with .htaccess, adding "deny from all" should be all you need.
@Kraze^NFo> Juski has a very valid point
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
RTWNick
New to forums
New to forums
Posts: 7
Joined: Fri Mar 07, 2014 5:05 pm

Re: Block Directory using .htaccess

Post by RTWNick »

That works, but then I cannot see any styling at all. The user cannot see the CSS on the page so all the styles are gone.
User avatar
kraze
Former staff
Former staff
Posts: 4362
Joined: Fri Sep 17, 2010 9:06 am
Location: California

Re: Block Directory using .htaccess

Post by kraze »

You may try switching it out for "Options All -Indexes".
@Kraze^NFo> Juski has a very valid point
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
RTWNick
New to forums
New to forums
Posts: 7
Joined: Fri Mar 07, 2014 5:05 pm

Re: Block Directory using .htaccess

Post by RTWNick »

That worked magically. Thanks for your help.
Post Reply