Webmaster Forum

Go Back   Webmaster Forum > Web Development > Web Design Lobby

Web Design Lobby Forum for general web design issues not specific to scripting or graphics.


Reply
 
LinkBack Thread Tools Display Modes
Old 11-14-2008, 07:23 PM   #1 (permalink)
Contributing Member
 
Join Date: 02-26-08
Location: Cali
Posts: 122
iTrader: 0 / 0%
Latest Blog:
None

Nuroo is on the right pathNuroo is on the right path
Protecting specific directories?

What is the best way to restrict access to directories of your choice? For example, when you upload a picture or any file in Wordpress it goes to the upload folder. If somebody wanted to, they can just type in the direct URL to the upload folder and then have access to everything in it. Same thing for the wordpress image folder. Does everybody use redirects? Or password protect? What's the most common or "professional" way to restrict access? Thanks all!
Nuroo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-15-2008, 06:32 AM   #2 (permalink)
Contributing Member
 
mr.joebert's Avatar
 
Join Date: 04-07-08
Location: Clearwater, FL USA
Posts: 91
iTrader: 0 / 0%
mr.joebert is liked by somebodymr.joebert is liked by somebodymr.joebert is liked by somebody
It depends on how an application uses the files in that directory.

If the application outputs links directly to files in that directory, then your only real options are using something like the following in the folders htaccess file to prevent mod_autoindex from showing a listing of the files in there. This is assuming your setup is Apache and allows you the "Options Override" in htaccess.
Code:
Options -Indexes ErrorDocument 403 "Access Denied
Or, adding a blank "index.html" for Apache, and for IIS "default.html" in the folder to prevent the indexing. Adding the blank HTML file will work just about anywhere, but it's not very good at explaining what's happening to the user.

Doing it one of those ways will keep the visitor from aimlessly browsing around in the content folders, they will need to know what they're looking for to access it. Password protecting the directories in this situation just doesn't make sense, because the appication needs to be able to direct legitimate visitors to the files in there.


However if the application is one that generally uses links similar to "file.php?file=123456" you can handle it in a few other ways, in addition to the ones above.

One would be to use CPanel to "Pasword Protect Directories" which will setup HTTP Basic Authentication (when the browser pops up a login window). You can consult the CPanel (or similar control panel) documentation about how to do that.

Another would be to modify for instance, htaccess in an Apache server, to deny from all by adding this to an (or the) ".htaccess" file in the folder in question.
Code:
Deny From All
that directive essentually tells the Apache server to do exactly what it says, deny serving requests from all who make requests.

Last edited by mr.joebert; 11-15-2008 at 06:35 AM..
mr.joebert is online now  
Add Post to del.icio.us
Reply With Quote
Old 11-15-2008, 08:31 AM   #3 (permalink)
Contributing Member
 
Join Date: 02-26-08
Location: Cali
Posts: 122
iTrader: 0 / 0%
Latest Blog:
None

Nuroo is on the right pathNuroo is on the right path
I think I'll try the blank index page trick. By default, wordpress and my server does index every file in a directory and I don't want that obviously. I'm still pretty new to this but I will look into the httaccess suggestion also.
Nuroo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-19-2008, 03:03 AM   #4 (permalink)
Contributing Member
 
Join Date: 02-26-08
Location: Cali
Posts: 122
iTrader: 0 / 0%
Latest Blog:
None

Nuroo is on the right pathNuroo is on the right path
Ok, say I password protect my folder with all my images. The image directory is not even visible unless you put the complete URL, but it is used to store my template images like the logo, header, etc. So if I password protect that folder, will visitors still see my logo and header images on their browsers? Or will my page show up on their browsers with no images where the logo and header are supposed to be?
Nuroo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-19-2008, 07:39 AM   #5 (permalink)
Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 1,293
iTrader: 2 / 100%
Latest Blog:
None

ScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest order
Quote:
Originally Posted by Nuroo View Post
Ok, say I password protect my folder with all my images. The image directory is not even visible unless you put the complete URL, but it is used to store my template images like the logo, header, etc. So if I password protect that folder, will visitors still see my logo and header images on their browsers? Or will my page show up on their browsers with no images where the logo and header are supposed to be?
Probably not. Meaning the images will not show because the script can not access the directory.

The blank index or one that says Forbidden is a better choice.
__________________
These forums are as good as the posts that you contribute to them.
~~
ScriptMan
Webmaster Help Articles
Domains & Sites For Sale by Owner
ScriptMan is online now  
Add Post to del.icio.us
Reply With Quote
Old 11-19-2008, 01:44 PM   #6 (permalink)
Contributing Member
 
Join Date: 02-26-08
Location: Cali
Posts: 122
iTrader: 0 / 0%
Latest Blog:
None

Nuroo is on the right pathNuroo is on the right path
Quote:
Originally Posted by ScriptMan View Post
Probably not. Meaning the images will not show because the script can not access the directory.

The blank index or one that says Forbidden is a better choice.
So redirects aren't usually used in these cases?
Nuroo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-19-2008, 02:06 PM   #7 (permalink)
Moderator
 
~kev~'s Avatar
 
Join Date: 02-06-08
Location: Texas
Posts: 851
iTrader: 0 / 0%
~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro~kev~ is a highly respected web pro
Just create a simple index.html file and put it in the directory. If there is no index file google can scan the images in the directory and list them in its image search results. There is no real need to password protect an images directory if the images are viewable by the public. If you do that, the images will not be displayed.

At the top of the index page, put something like - "You may not view the contents of this directory or folder"

Place a link going to your home page, or your forum on the index page.

Put a 3 - 5 second redirect script in the header. I am using a 3 second redirect in my index.html pages.

So when someone tries to probe my images directory, they will get the index and can either click a link to go to the home page, the forum, or be sent to the home page after 3 seconds. So by the time they read what the page says, the redirect script sends them to the blogs home page anyway.


=================== EDIT =======================

Here is the code for my index.html file.

If 3 seconds is too long for you, change the content="3 to content="what ever number you want You can even set it to 1 second. And 1 second after hitting the images directory index file, the person will be sent to your home page.


<html>

<meta http-equiv="refresh" content="3; url=insert the address you want people sent to here">


<body>

You may not view the contents of this directory.

<br><br>

<a href="insert the address of your site here">insert the name of your site here</a>

<br><br>


<br><a href="insert the address of your site here">insert the name of your site here</a>

</body></html>

Last edited by ~kev~; 11-19-2008 at 02:18 PM..
~kev~ is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-22-2008, 04:47 PM   #8 (permalink)
Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 1,293
iTrader: 2 / 100%
Latest Blog:
None

ScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest order
Why don't you just put a blank or forbidden index page in there and simply this whole mess?
__________________
These forums are as good as the posts that you contribute to them.
~~
ScriptMan
Webmaster Help Articles
Domains & Sites For Sale by Owner
ScriptMan is online now  
Add Post to del.icio.us
Reply With Quote
Old 11-23-2008, 03:44 PM   #9 (permalink)
Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 1,293
iTrader: 2 / 100%
Latest Blog:
None

ScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest order
I must have missed one of the posts, I was only suggesting it for your image directory which is where this thread started.

Glad you worked it out to your satisfaction.
__________________
These forums are as good as the posts that you contribute to them.
~~
ScriptMan
Webmaster Help Articles
Domains & Sites For Sale by Owner
ScriptMan is online now  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting Intellectual Property baldlygo Marketing Forum 9 09-16-2006 04:38 AM
Protecting Site's Text tsptom Coding Forum 11 04-10-2006 09:46 PM
Directing specific users to a specific folder Kenny Fix Coding Forum 3 03-19-2006 08:57 AM
Niche specific directories are the way forward! altyfc Web Directory Issues 0 10-14-2003 01:18 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:23 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.