WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Graphics & Design Discussion Forum > Accessibility and Usability Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Accessibility and Usability Forum Discuss topics related to website accessibility and usability. Subjects include; testing techniques, tutorials, guidelines and legal issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-04-2006, 05:23 AM
WebProWorld Member
 

Join Date: Dec 2003
Location: UK
Posts: 61
purex RepRank 0
Default Prevent Access to Folders

I am sure this is a really simple question for most but how do I restrict access to certain folders on my website without harming surfers or the search engines viewing my site.

For example, at the moment if someone types

www.domain.com/images

Then all my images are listed on a page entitled 'Index of /images'

If some types

www.domain.com/pages1to10

for example, then a list of 10 html pages is shown that reside in the folder 'pages1to10'

Thanks in advance for replies.
Reply With Quote
  #2 (permalink)  
Old 08-04-2006, 05:53 PM
WebProWorld New Member
 

Join Date: Oct 2004
Posts: 11
bconley RepRank 0
Default

Directory browsing needs to be turned off. Depending on how your website is hosted, you may or may not be able to do this yourself. Ask your web host for instructions on how to do this. Once this is done, you need to have an index page set up in a folder that will have HTML pages. The index or default page will be the first page that shows if the folder is used as part of the URL - www.domain.com/folder
Reply With Quote
  #3 (permalink)  
Old 08-04-2006, 06:25 PM
Weedy Lady's Avatar
WebProWorld Veteran
 

Join Date: Nov 2003
Location: mid south USA
Posts: 377
Weedy Lady RepRank 0
Default

Make a file named .htaccess and load it to each folder (directory) where you want the items to "not display".

Type the following exactly the way it is here into NOTEPAD:

<Files .htaccess>
order allow,deny
deny from all
</Files>
IndexIgnore */*

Then save it as .htaccess. Do not save it as .htaccess.txt because it will not work. You may have to rename it after you load it to take the .txt off of the end.

Then when someone types into their browser: http://www.yoursite.com/images
they will get a nice blank page for that folder/directory

The search engines will find everything. People surfing will find everything. Just the contents of the folder/directory will not display in a browser.

I assume this is what you want to do.
__________________
The Weedy Lady at
http://www.happydaycards.com
Free E Cards for holidays and all occasions, fun pages and great recipes.
Reply With Quote
  #4 (permalink)  
Old 08-04-2006, 06:43 PM
WebProWorld Member
 

Join Date: Feb 2004
Posts: 46
richard-s RepRank 1
Default Simple: Put a default page in ever folder

Many web servers are set to serve (ie. display) a default web page, when no other page is specified.

For example, when someone types just the domain name of my web site, without specifying a particular web page, they will receive the "index.html" web page.

The same happens for all my folders.

To stop people browsing my folders, I always place an "index.html" page in each folder. This page shows basic contact type information.

As "belt and braces" each folder also has an "index.htm" page which redirects browsers to the "index.html" web page.

Richard
___________
www.hemyockcastle.co.uk
Comfortable accommodation amongst the Blackdown Hills, Devon, UK
Reply With Quote
  #5 (permalink)  
Old 08-04-2006, 07:30 PM
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Mass, U.S.A.
Posts: 434
Conficio RepRank 0
Default Re: Prevent Access to Folders

Quote:
Originally Posted by purex
For example, at the moment if someone types

www.domain.com/images

Then all my images are listed on a page entitled 'Index of /images'

If some types

www.domain.com/pages1to10

for example, then a list of 10 html pages is shown that reside in the folder 'pages1to10'
Is that really true? I'm just wondering, because a URL that does not end in a "/" slash is not a directory listing. So
www.domain.com/images/
should bring up the index of the images folder.

Otherwise the prevention of this effect depends on your web server (Apache, IIS, ...) and youar ability to configure it (access through ssh, ftp, or Plex, Webadmin, ...). I'd say you best ask this question to your hosting provider or in its forums. This will give you the most correct answer for your situation.

K<o>
Reply With Quote
  #6 (permalink)  
Old 08-05-2006, 03:06 AM
WebProWorld New Member
 

Join Date: Dec 2005
Location: Espoo, Finland
Posts: 3
Kotiniemi RepRank 0
Default

While this won't prevent actual access like .htaccess file does, it will prevent unintentional listing of images within a directory by simply creating something else for the browser to see - hope it helps:

Hiding the contents of a homepage directory
Reply With Quote
  #7 (permalink)  
Old 08-05-2006, 09:22 AM
DrTandem1's Avatar
WebProWorld 1,000+ Club
 

Join Date: Oct 2003
Location: Encinitas, CA
Posts: 1,908
DrTandem1 RepRank 2
Default

Most hosts allow you to set "permissions" for your folders. It's probably in the file manager section of your control panel. You should see something regarding permissions and they are a three-digit code.

You'll need to navigate to the folder in question. For you, that would be "images." You need to change the permissions to a code of 711.

After doing so, if a person tries to access your images folder directly, they will get a 403 error, forbidden. You can usually modify your error pages to be custom, if you desire.

This is also called chmod when executed in a shell script. Pronounced "chee-mod." The code is the same.
__________________
DrTandem's San Diego Web Page Design, drtandem.com
Reply With Quote
  #8 (permalink)  
Old 08-06-2006, 05:57 AM
Mar Mar is offline
WebProWorld New Member
 

Join Date: Nov 2003
Location: Helensburgh
Posts: 6
Mar RepRank 0
Default You've just made me realise

that I'm not always consistent in this :) - protecting images folders by adding an index.html is good. However, I think that putting up a blank page is missing a golden opportunity to add in at least your site navigation structure and a Google search box. That way, people could either search your site or the web - and you might earn some extra money from that. The really cool feature about Google site search boxes is that they allow you to specify that the search opens up a new window, effectively allowing you to retain visitors.

:)

Margaret
Reply With Quote
  #9 (permalink)  
Old 08-08-2006, 06:14 AM
WebProWorld Member
 

Join Date: Dec 2003
Location: UK
Posts: 61
purex RepRank 0
Default Thanks all

Thanks for all your kind help.

I went with DrTandem1's idea. I use Fetch ftp software which comes up with a permissions box.

Read Write Search/Execute
Owner X X X
Group - - X
Everyone - - X

X=checked box

This tells me it is the UNIX equivalent of chmod711?

I have applied this to http://www.laserfume.com/images/

It seems to work. Do you agree?

This led me onto 2 more thoughts.

1. Can you customize the 'Forbidden' page ?
2. If someone mis-types a URL for my site, for example laserfume.com/indx.html is there a way of showing a default 'You have mis-typed and will be automatically directed to our home page now' page?
__________________
http://www.salonstore.co.uk - Nail stations with extraction to filter nail dust in salons.
Reply With Quote
  #10 (permalink)  
Old 08-08-2006, 08:32 AM
DrTandem1's Avatar
WebProWorld 1,000+ Club
 

Join Date: Oct 2003
Location: Encinitas, CA
Posts: 1,908
DrTandem1 RepRank 2
Default

Yes, Read, Write Execute.
__________________
DrTandem's San Diego Web Page Design, drtandem.com
Reply With Quote
  #11 (permalink)  
Old 08-08-2006, 08:49 AM
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Mass, U.S.A.
Posts: 434
Conficio RepRank 0
Default Re: Thanks all

Quote:
Originally Posted by purex
This led me onto 2 more thoughts.

1. Can you customize the 'Forbidden' page ?
2. If someone mis-types a URL for my site, for example laserfume.com/indx.html is there a way of showing a default 'You have mis-typed and will be automatically directed to our home page now' page?
Yes, it is called custom error pages. How to do it is highly dependent on your kind of webserver (apache or IIS) and how it is configured. You best google with "custom error pages <webserver-name>".

The pages you want to customize are for error code 403 (page forbidden) and 404 (page not found).

I'd recommend to make the 404 a copy of the home page with the additional text of an error. I find it rather distracting if websites do not show me an error but redirect me automatically to another page.

K<o>
Reply With Quote
  #12 (permalink)  
Old 08-08-2006, 12:10 PM
WebProWorld Member
 

Join Date: Dec 2003
Location: UK
Posts: 61
purex RepRank 0
Default

Are these correct in your view?

http://www.laserfume.com/images

http://www.laserfume.com/oopswrongpage.html

Things I noted. All the links (inc image sources) on the 'not found' page have to be absolute, i.e 'http://www.laserfume.com/link.html' because 'link.html' does not work if a visitor types in a wrong url including a directory. For example http://www.laserfume.com/images/page.html
__________________
http://www.salonstore.co.uk - Nail stations with extraction to filter nail dust in salons.
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum > Accessibility and Usability Forum
Tags: , ,



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

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


Search Engine Optimization by vBSEO 3.2.0