CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   ErrorDocument Without HTTP Response Code (http://www.codingforums.com/showthread.php?t=280817)

Custard7A 11-04-2012 12:08 PM

ErrorDocument Without HTTP Response Code
 
I was wondering if this is viable. Consider this format:

ErrorDocument 400 /error.php?id=400
ErrorDocument 401 /error.php?id=401
ErrorDocument 403 /error.php?id=403
ErrorDocument 404 /error.php?id=404
ErrorDocument 500 /error.php?id=500

Could I simply use..

ErrorDocument * /error.php

.. and glean the response code from the headers instead? It would open up some new dynamic options for error handling.

P.S. I'm not sure what response codes are in the ErrorDocument scope. ErrorDocument * might be a silly idea in itself.

Custard7A 11-05-2012 05:57 AM

I got around to some tests today, both ErrorDocument /error.php and ErrorDocument * /error.php cause internal server errors. I don't know if there is a syntax I'm not using — I just guessed at those two — or if it's plain not supported. That's all I got, for curiosities' sake.

Inigoesdr 11-05-2012 11:23 PM

The first option should work, but AllowOverride has to include FileInfo in the httpd.conf in order for you to be able to use ErrorDocument in the .htacess files. There is some more information in the Apache Manual page that tells you the allowed arguments you can use.

Custard7A 11-06-2012 01:58 AM

Thanks Inigoesdr,

I don't have access to http.conf on my host, but I've been using ErrorDocument in the .htaccess. I assume this means it's set up to work right. I also had a look at the documentation before posting this, but it doesn't say anything about one argument that can redirect all errors.

I'm not sure which option you refer to as the first, if you mean this..

ErrorDocument 400 /error.php?id=400
ErrorDocument 401 /error.php?id=401
ErrorDocument 403 /error.php?id=403
ErrorDocument 404 /error.php?id=404
ErrorDocument 500 /error.php?id=500


.. That's what I got now, it's the other statements I was interested in.

felgall 11-06-2012 08:56 PM

If

ErrorDocument * /error.php

were to work at all then I'd expect it to also process 200, 301 and 302 - which would then cause a recursion error when displaying error.php as that would be expected to generate a 200 and thus redirect to itself over and over until exceeding recursion limits.


All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.