How to deny access to a folder

wachtn

New Member
Thank you.
I dont have any web design training. Just got the software needed and have been slowing learning how to use it.

Can you suggest the proper values to use? I have played around with CHMOD already but I wound up denying access to everything within the directory not just to that only level of my site.

example:
If I changed the permission to for the directory www.site-root.com/image_folder/ every image, site wide, that was stored in that directory was blocked.
 

pjmcdermott

New Member
use a javascript redirect code

A very simple way to do this is to create an index.html page in the folder that you want to keep people out of that has a JavaScript re-direct code in it that will redirect to the homepage when the someone types in the url of the folder.

For example, you have www.sitename.com/images. You want to keep someone out of the images folder. With a java script redirect code you can do this easily. It will redirect from www.sitename.com/images to www.sitename.com (your homepage).

The code looks like:

<script type="text/javascript">
<!--
window.location = "http://www.sitename.com/"
//-->
</script>

Paste this in the head section of the index.html page you create in the folder you wish to block, replacing sitename.com with your URL. (Leave the http://, it is needed to find the site.
 

wachtn

New Member
pjm, Great suggestion. Thank you for that code. Putting it someplace safe right now. I have used a similar tech with an index.html that said "click here to return to the home page."

You code is much better tho. Thank you.
 
Top