barkster Posted April 14, 2008 Share Posted April 14, 2008 I'm writing a http authorization script and instead of manually displaying the http header error is there a way to display the default apache error. Or should I redirect to a custom error page? header('WWW-Authenticate: Basic realm="Private"'); header("HTTP/1.0 401 Authorization Required"); echo "Your not authorized"; I want to display the default like this: Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/1.3.41 Server at www.domain.com Port 80 Link to comment https://forums.phpfreaks.com/topic/101066-display-system-401-header/ Share on other sites More sharing options...
rhodesa Posted April 14, 2008 Share Posted April 14, 2008 I'm pretty sure you have to write your own custom 401 page. If you want to have all your error pages (apache and custom) match, you can configure Apache to use one of your custom pages instead of it's default pages Link to comment https://forums.phpfreaks.com/topic/101066-display-system-401-header/#findComment-516981 Share on other sites More sharing options...
barkster Posted April 14, 2008 Author Share Posted April 14, 2008 so your saying there is no way to tell apache to throw a particular error? Whats the point of this line then "header("HTTP/1.0 401 Authorization Required");" Link to comment https://forums.phpfreaks.com/topic/101066-display-system-401-header/#findComment-516986 Share on other sites More sharing options...
rhodesa Posted April 14, 2008 Share Posted April 14, 2008 That is for the client. That tells the browser a 401 Error has occurred. Link to comment https://forums.phpfreaks.com/topic/101066-display-system-401-header/#findComment-516987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.