Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-04-2012, 12:08 PM   PM User | #1
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
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 is offline   Reply With Quote
Old 11-05-2012, 05:57 AM   PM User | #2
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
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.
Custard7A is offline   Reply With Quote
Old 11-05-2012, 11:23 PM   PM User | #3
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
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.
Inigoesdr is offline   Reply With Quote
Old 11-06-2012, 01:58 AM   PM User | #4
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
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.
Custard7A is offline   Reply With Quote
Old 11-06-2012, 08:56 PM   PM User | #5
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,447
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Tags
errordocument

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:42 PM.


Advertisement
Log in to turn off these ads.