I have a setup w/ zend framework.

I have a development site which I have protected with require valid-user.

I want to setup a custom 401 ErrorDocument that tells myusers to goto the production site (if they stumble on dev site)

When I add ErrorDocument 401 error/401.html to the .htaccess, I get the standard Authorization Required string plus:

Additionally, a 401 Authorization Required error was encountered while trying to use an ErrorDocument to handle the request.

I don't know enough about Apache's rules to make a rule to allow that document to be viewed, any ideas?

    Try something like...

    <Files 401.html>
    Order allow,deny
    Allow from all
    </Files

    to make sure that Apache doesn't require authentication for it.

      bradgrafelman,

      Thanks for the suggestion however it did not seem to work for me.

      Here is what I have tried:

      # Set Access Restrictions
      
      AuthName "Development Area" 
      AuthType Basic 
      AuthUserFile /path/to/.htpasswd 
      AuthGroupFile /dev/null 
      require valid-user
      ErrorDocument 401 /error/401.html
      
      <Files error/401.html>
      Order allow,deny
      Allow from all
      </Files>
      RewriteEngine On
      RewriteCond &#37;{REQUEST_FILENAME} -s [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^.*$ /index.php [NC,L]
      

      I have also tried /error/401.html and 401.html only under the files definition.

      Thanks, I know there must be a way!

        ErrorDocument 401 /pagenotfound.php
        ErrorDocument 403 /pagenotfound.php

        should do it...

        edit:
        if it is in a directory called 'error' I bet its not finding the directory properly

          cretaceous,

          I tried leaving the document in the root as well, even though that is untidy with my structure and it didn't work.

          Thanks though!

            Write a Reply...