Web Hosting Forums

Results 1 to 6 of 6

This is a discussion on Error pages. in the Hosting Talk & Chit-chat forum
Hey everyone. I want to have a directory off of my site have a "forbidden" error page come across when someone tries to access that ...

  1. #1
    Loyal Client
    Join Date
    Mar 2003
    Posts
    6

    Error pages.

    Hey everyone. I want to have a directory off of my site have a "forbidden" error page come across when someone tries to access that directory.

    Ex: http://vixon.net/blah

    I've tried a search and only found error pages to block one page.

    Ex: http://vixon.net/blah/blah.html

    How do I stop someone from viewing what's inside the directory? Aka, what are the codes and steps?

    I've tried playing around with the customer error docs and the .htaccess but I can't get it straight. Any suggestions?

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    Well, if you chmod that directory to prevent read and execute access by world/all, 700 for example, then you'll get the forbidden error. You can also use password protection of the directory to keep unauthorized users form getting in. However, if you are trying to make a place where you can store things that you don't want web users to get aceess to, you really should make a directory that is outside of your public_html directory. That's the safest place beacuse there is no way anyone will get to that directory from the browser (although your scripts will still be able to access that directory, if you are using it to store data or config files for your scripts).

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    Loyal Client
    Join Date
    Mar 2003
    Posts
    6
    well i want to store images in http://vixon.net/imgs/

    I want the images to be viewable on the index.html page of vixon.net/index.html (I know how to do that).

    But when someone is looking at my coding, and wants to see what other images I have, I want them to see a error page when trying to look in my directory.

    I know I can just upload a blank index.html file into the directory to keep them from looking, but that's a lot of directories I'm going to have to upload that in.

    I was just wondering if there's an easier way to do it? If I CHMOD the folder to 700, will they still be able to view the images on the index.html file of the root directory (public_html)?

  4. #4
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    That's an easy one...

    Create a file called .htaccess (if you are on windows, you may have a problem creating files that start with dots. I always make it htaccess.txt and rename after I ftp it). In that file, put a line that looks like this:

    Options -Indexes

    Then upload the file into your public_html. Alternatively, you can use the .htaccess editor in CPanel to do the same thing.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  5. #5
    Aletia Refugee lvzardoz's Avatar
    Join Date
    Feb 2002
    Location
    Las Vegas
    Posts
    164

    Alternative method

    Example: http://www.vbds.com/img/

    create a simple Javascript file named "byebye" in your public_html directory containing this:

    <script language="Javascript">history.go(-1);close(self)</script>

    then link the file into your non-html directories.

    ln byebye imgs/index.html
    ln byebye sounds/index.html
    ln byebye movies/index.html

    etc.

    Bob Carroll

    P.S. However, if you haven't set up SSH (secure telnet) access, this method won't be possible. You can't "link" using FTP.
    Last edited by lvzardoz; 03-29-2003 at 12:11 AM.

  6. #6
    Loyal Client
    Join Date
    Mar 2003
    Posts
    6
    Yeah I have SSH, or I should have SSH available. I know that I can "link" it through putty.exe but.. I just don't know how to code it that way.

    Oh well, thanks anyways!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •