Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ErrorDocument work with .html but not with .php

1 view
Skip to first unread message

Matthias

unread,
Nov 22, 2009, 9:20:13 AM11/22/09
to
I would have a .htaccess containing the directive:
ErrorDocument 401 /backup4u/index.php

But that didn't work. And I get no error message
in /var/log/apache2/error.log

On the other side:
ErrorDocument 401 /backup4u/logout.html
would work.

Is there anything to do for get ErrorDocument get working with php files?

Thanks
Matthias
--
Don't Panic

Swifty

unread,
Nov 22, 2009, 1:21:41 PM11/22/09
to

My first thought would be to fetch /backup4u/index.php from the site.
That should fail (401) but also it should create an error log entry.

With all "Not authorised" or "Forbidden" type errors, I logon as apache
and try to access the file, e.g. "cat /var/www/html/backup4u/index.php"
so I know whether I should be looking in apache, or in the filesystem.
It helps to know where to start.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

"Álvaro G. Vicario"

unread,
Nov 23, 2009, 3:48:08 AM11/23/09
to
Matthias escribi�:

> I would have a .htaccess containing the directive:
> ErrorDocument 401 /backup4u/index.php
>
> But that didn't work. And I get no error message
> in /var/log/apache2/error.log

In what way doesn't it work?

Whatever, when you are handling an authorization error you should make
sure that the error page does not trigger the error (i.e., is reachable
even for non authorized users).

> On the other side:
> ErrorDocument 401 /backup4u/logout.html
> would work.
>
> Is there anything to do for get ErrorDocument get working with php files?

Not that I know.

--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Matthias

unread,
Nov 23, 2009, 6:59:01 PM11/23/09
to
Swifty wrote:

I can access http://localhost/backup4u/index.php.
It is the start page of my pages.
Within that I have a directory called secure. A visitor have to login there.
If I cancel the login dialog he should be redirected to /backup4u/index.php.

Maybee my secure/.htaccess is interesting:

# Support the biggest software vendor on the planet which produces
# the biggest load of crap
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
ErrorDocument 401 /backup4u/index.php

<Files .login>
AuthType Basic
AuthName "Backup4U"
AuthUserFile /etc/backuppc/htpasswd
Require valid-user

RewriteEngine on
RewriteCond %{REMOTE_USER} !=""
RewriteRule ^.*$ /backup4u/secure/ [R]
</Files>

<Files .logout>
RewriteEngine on
RewriteRule ^.*$ /backup4u/secure/logout.html [R]
</Files>

<Files .logout_mozilla>
AuthType Basic
AuthName "Backup4U"
AuthUserFile /etc/backuppc/htpasswd
Require valid-user
</Files>

--
Don't Panic

Solbu

unread,
Nov 24, 2009, 8:40:45 AM11/24/09
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matthias sent the following transmission through subspace:

> I would have a .htaccess containing the directive:
> ErrorDocument 401 /backup4u/index.php
>
> But that didn't work. And I get no error message
> in /var/log/apache2/error.log

What /Does/ happen when you open that page?
is there a blank page, is there an error code on the page it self.

What happens when you open the page...

- --
Solbu - http://www.solbu.net
Remove 'ugyldig.' for email
PGP key ID: 0xFA687324
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFLC+JgT1rWTfpocyQRAvlbAJ0b9RPejw+nzQht/XweFFG1zSzsswCgmMPJ
oNV7ZgQ4SLrFZNOq0fJbgL0=
=7e0s
-----END PGP SIGNATURE-----

Matthias

unread,
Nov 29, 2009, 12:53:55 PM11/29/09
to
Matthias wrote:

Solved.
I access /backup4u/abortLogin.html which then redirect the browser
to /backup4u/index.php.

But I believe thats not the really solution for my problem. I've changed a
lot of other things too. Maybee a combination of that solve my problem.

0 new messages