Re: Using PHP and Apache's .htaccess files.
| From: | Andy | Date: | Thu, 20 Jun 2002 20:34:06 +0000 |
| Subject: | Re: Using PHP and Apache's .htaccess files. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103202@lists.php.net to get a copy of this message | ||
hello Todd,
there is a directive where you can redirect errors to certain pages withhin
the htaccess file.
I do not remember the exact syntax, but it looked like...
ErrorDocument 401 /root/to/your/file.html
Please check the apache docs it this does not work.
Andy
--
----------------------------------------------------
http://www.globosapiens.net
Global Travellers Network!
"Todd Fernandes" <tfernand@impole.com> schrieb im Newsbeitrag
news:001001c2188d$9614b4f0$3cc8a8c0@impole.com...
> Here is my question. It involves using PHP and apache's .htaccess files.
>
> What I basically want to know is, how do I redirect a bas user after a
> failed Authentication attempt.
>
> Example:
> One PHP script checks to see if $PHP_AUTH_USER is set and if not calls
> header( sprintf("WWW-authenticate: basic realm=\"%s\"", $g_auth_realm ));
> header( "HTTP/1.0 401 Unauthorized" );
>
> to get them to provide a username and password. Now, how to I check that
> against the .htaccess and .htpasswd files I have in a subdirectory below
the
> script.
>
> The way I have it working now is that I check to see if $PHP_AUTH_USER is
> set, and if it is, I send them to the page that is a directory down behind
> the .htaccess file. Working that way, if they are an invalid user, they
are
> prompted again, if they hit cancel, they get the 401 page. I want to give
> them a custom error message instead of the generic 401 page.
>
> Any ideas on how to avoid the 401 page?
>
> Thank you,
> Todd
>