This Page Cannot Be Displayed instead of 403 for mod_access directive

Posted on 2007-10-07
Last Modified: 2012-06-27

The following returns "403 Forbidden" unless you have the correct env.
         Order Deny, Allow
         Deny from all
         Allow from env=let_me_in

I don't want a "403 Forbidden" -- instead I want "This Page Cannot Be Displayed" unless you have the correct env.  The same error you would get if the server was offline.  Can this be done from .htaccess or httpd.conf?

Question by:hankknight
    LVL 57

    Assisted Solution

    Possibily.  IE allows you to configure it for friendly messages.  If IE is configured for friendly messages, then it will ignore any custom error message you create.

    You can visit:

    or any other site you find searching for custom apache errors

    The basic is that you add:

         ErrorDocument 403 /error-docs/403.html

    in your .htaccess file.  Then you create your custom error page in that file in that directory.  The path can be anyplace you want.
    LVL 16

    Author Comment

    Thank you, but that does not answer my question.  My question is how to avoid sending out a 403 header and instead not to send back ANYTHING at all.
    LVL 57

    Expert Comment

    The only way I am aware of is to modify the source code of Apache to not respond.
    LVL 15

    Expert Comment

    just to elaborate what has been mentioned by giltr:

    The error code are very much the standard -

    403 Forbidden
    404 Not Found

    since in this case the client that does not had the env var "let-me-in" configured -- the server would throw a 403 error.

    a trick -- which I never tested :) is to "redefine" 403 -- to any of this option.

       1.  output a simple hardcoded error message
       2. output a customized message
       3. redirect to a local URL-path to handle the problem/error
       4. redirect to an external URL to handle the problem/error

    since you insist on 404 error to be returned, you could redifined to a resources that is not protected (by the access control that you defined earlier), and make sure that particular page does not exist.  Thus, client may get a 404 (Not Found).

    i hope this may work :)


    LVL 15

    Expert Comment

    i had tried to catch 401 error, and redirect to a page that does not exist.  however, the server still sends 401 error, together with a 404 (since the redirected page does not exist).

    I am not sure if this satisfy you.

    ==quote from

    ErrorDocument Directive
    Description:      What the server will return to the client in case of an error
    Syntax:      ErrorDocument error-code document
    Context:      server config, virtual host, directory, .htaccess
    Override:      FileInfo
    Status:      Core
    Module:      core
    Compatibility:      Quoting syntax for text messages is different in Apache 2.0
    LVL 15

    Accepted Solution

    check this page out -- that may be possible :

    basically, just catch the 403 error using ErrorDocument and redirect it to a cgi script that throw a 404 response to the client.

    give it a shot.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    Mod_Rewrite, htaccess, opencart 4 74
    Apache server crashes randomly 38 105
    htaccess file 3 52
    Change local server setting in php 6 31
    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now