Submit Your Article Forum Rules

Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: 403 Forbidden error document::: How to do it?

  1. #1
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,999

    Question 403 Forbidden error document::: How to do it?

    SEO related or not, I post the question here.

    How shall I set up a 403 forbidden / access denied error document.

    1. I have made a 403.htm 403 aceess denied document.
    2. With the following .htaccess line: ErrorDocument 403 /403.htm


    Problem, I only get the following standard? message:

    "Forbidden
    You don't have permission to access / on this server.

    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.41 Server at www.forumnorway.com Port 80"

    What am I doing wrong?

    I have no problem with a similar 404.htm error document and the .htaccess line:

    ErrorDocument 404 /404.htm

  2. #2
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    3,138

    Re: 403 Forbidden error document::: How to do it?

    I take it you have the entire site set up to be denied or password protected. Since the 403.htm file is in an area that is forbidden, the user isn't allowed to view the document.

    The workaround is to create a folder below the main directory, called, for example, /errordocs/. Create the following lines in your .htaccess file

    <Folder /errordocs/>
    Order alllow, deny
    Allow from all
    </Folder>
    RedirectMatch 404 ^/errordocs/

    This setup will ensure that even if the user is denied access to the contents of the site, error messages will still be displayed. The RedirectMatch is a hack to prevent users from being able to access the URL /errordocs/403.htm and thus being able to directly access the error documents.

    Note that this method might conflict with the existing directives that lock down the entire site. If that happens, you would need to create an .htaccess file in the errordocs folder that contains the Order and Allow directives.
    The best way to learn anything, is to question everything.
    WigeDev - Freelance web and software development

  3. #3
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,999

    Re: 403 Forbidden error document::: How to do it?

    Thank you for your input so long.

    Quote Originally Posted by wige View Post
    I take it you have the entire site set up to be denied or password protected. Since the 403.htm file is in an area that is forbidden, the user isn't allowed to view the document.
    Both.

    I assume that you can not see http://www.forumnorway.com/

    ForumNorway - 403 Error - Restricted access

    Can you se that 403 document?

    On local host I see the correct 403 document.

    Error 403 - Restricted access.

    Possible solutions
    MultifinanceIT::: Contact us page.
    Navigate to our mininet::: DigitalPunkt

    On the internet It redirects to the 404.htm document that is different, so there may be an error in the root .htaccess file I guess. Since you are online, you may see the error before I experiment with different solutions.

    Quote Originally Posted by wige View Post
    Note that this method might conflict with the existing directives that lock down the entire site. If that happens, you would need to create an .htaccess file in the errordocs folder that contains the Order and Allow directives.
    That is my preferred method since I am used to it.

    I have the following lines in the roor folder .htacces file:

    # '403 Forbidden' error
    RedirectMatch 404 ^/errordocs/
    ErrorDocument 403 /errordocs/403.htm


    Is that correct?

    Then in the errordocs sub folder I put:

    ## File paths are relative to the Document Root (/)
    # '404 Not Found' error
    ErrorDocument 404 /404.htm
    # '403 Forbidden' error
    ErrorDocument 403 /403.htm
    # '401 Unauthorized' error
    ErrorDocument 401 /401.htm
    # Or..
    # ErrorDocument 401 "The webserver could not authorise you for content access.
    order deny,allow
    allow from all


    Fine?

    I commented out the line:

    RedirectMatch 404 ^/errordocs/

    and now I see the correct 403 document on the internet, but I have access. Should be interesting to see how one without access see the link.

  4. #4
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    3,138

    Re: 403 Forbidden error document::: How to do it?

    I am able to access the home page with out any errors, but I get a 404 error when trying to go to the error document. The .htaccess file in the errordocs folder does not need to contain ErrorDocument directives, because they are already set in the root folder's .htaccess. You should only need the directives Order and Allow.
    The best way to learn anything, is to question everything.
    WigeDev - Freelance web and software development

  5. #5
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,999

    Re: 403 Forbidden error document::: How to do it?

    Quote Originally Posted by wige View Post
    I am able to access the home page with out any errors, but I get a 404 error when trying to go to the error document.
    Then my allowed IP-list is too wide
    Quote Originally Posted by wige View Post
    The .htaccess file in the errordocs folder does not need to contain ErrorDocument directives, because they are already set in the root folder's .htaccess. You should only need the directives Order and Allow.
    Did you see the last part of my post edited after you posted yours?

    Any members without access that can tell how they see the 403 OR 404 error document(s)?

  6. #6
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    3,138

    Re: 403 Forbidden error document::: How to do it?

    Ok, now I am able to see both the forum and the 403 error page when using the link you provided.
    The best way to learn anything, is to question everything.
    WigeDev - Freelance web and software development

  7. #7
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,999

    Re: 403 Forbidden error document::: How to do it?

    Thank you very much. Wait for reaction from members that can not see the forum.

  8. #8
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    3,138

    Re: 403 Forbidden error document::: How to do it?

    Actually, if you are using your usual blocker, I think it might not be working. I tried accessing the site with a common spam bot (Jakarta), and was not blocked based on the user agent.
    The best way to learn anything, is to question everything.
    WigeDev - Freelance web and software development

  9. #9
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,999

    Re: 403 Forbidden error document::: How to do it?

    Can you try now?

    order deny,allow
    deny from all

    Forgot the last line above before allowing.

    Also made a common 403 / 404 (404.htm) document. May be the final solution or trying more tomorrow with a separate 403 and or 404 file.

    This http://www.forumnorway.com/errordocuments/403.htm under the current solution redirects to the new 404.htm document even if the 403.htm document is as explained above.

    It is night here. Tired.

  10. #10
    WebProWorld MVP edhan's Avatar
    Join Date
    Aug 2003
    Posts
    941

    Re: 403 Forbidden error document::: How to do it?

    Just tested it, it shows the standard 403 Forbidden error code.
    Find Out More About Renting Thai Amulets For Blessing Of Protection in Well Being & Wealth | Destiny of Fate | Exploring, Understanding & Learning The Basic Feng Shui Art Of Placement To Build Wealth & Harmony With Friends, Colleagues And Family Members In Relationships & Careers... Do you want a better lifestyle? Check it out today!

Page 1 of 3 123 LastLast

Similar Threads

  1. 403 Forbidden error document::: How to do it?
    By kgun in forum Search Engine Optimization Forum
    Replies: 12
    Last Post: 01-08-2009, 12:44 PM
  2. 403- forbidden Error
    By trancehead in forum Search Engine Optimization Forum
    Replies: 10
    Last Post: 05-31-2006, 05:17 AM
  3. Make Every Document A Marketing Document
    By WPW_Feedbot in forum Marketing Strategies Discussion Forum
    Replies: 2
    Last Post: 10-28-2005, 04:24 AM
  4. Help !! 81/.cobalt/error/forbidden.html
    By Dave2004 in forum IT Discussion Forum
    Replies: 3
    Last Post: 05-24-2004, 06:01 PM
  5. Error 403 forbidden using Checklink
    By martinacastro in forum Search Engine Optimization Forum
    Replies: 0
    Last Post: 03-26-2004, 09:38 AM

Posting Permissions

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