Redirect 401 “authorization required page” to custom page


Is there a simple way I can encode a front-end php redirect to a custom page upon error?

I have a page in a directory protected by an .htaccess password, but if you cancel the system dialog or enter the wrong details, you get a plain html message in the browser and have to navigate back.

Would be great to have custom error pages as a solution to this.



In the .htaccess file, just add

ErrorDocument 401 /401.html

And change 401.html to the name of the file you want to display.


  • Column Nullability/Optionality: NULL vs NOT NULL
  • stringify/parse edn in clojure/ClojureScript
  • Help with mod_rewrite
  • Removing the .php file extension from the URL Request
  • Using an enum contained in a Cloud Endpoint model on a Android client
  • dismiss Progress Dialog in another Activity … Android
  • How to remove all of a jQuery UI dialog when it is closed
  • Caliburn Micro, How to use ContentControl (or display 'sub' ViewModel) using ViewModel Fir
  • Perspective projection, 4 points
  • (Tcl/Expect) clear screen after exit
  • Scanner nextInt() and hasNextInt() problems
  • Laravel 4 routing not working due to .htaccess file?
  • jQuery: How to AJAXify WordPress Search?
  • Trying to get the char code of ENTER key
  • Laravel: Getting Session ID oddly truncates when using foreach
  • Web.config system.webserver errors
  • Bypass multiple inheritance in Java
  • Visual Studio 2010 debugger build correctly - compiler pdb and linker pdb not in synch?
  • htaccess add www if not subdomain, if subdomain remove www
  • How to suppress a dialog
  • Magento Fatal error: Maximum execution error solution, on WAMP
  • MongoError: Incorrect arguments
  • Django rest serializer Breaks when data exists
  • Cancel a live stream “fast motion” catch-up in Flash
  • Checking free space on FTP server
  • Alert pop up with LWUIT
  • Change Inet root folder for iis 7
  • Recording logins for password protected directories
  • how to do an event when i swipe from fragment to the other
  • Updated Ionic CLI but shows previous version (Windows)
  • Upload files with Ajax and Jquery
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Do I've to free mysql result after storing it?
  • A cron job substitute?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • json Serialization in asp
  • Proper folder structure for lots of source files
  • How does Linux kernel interrupt the application?
  • Authorize attributes not working in MVC 4
  • UserPrincipal.Current returns apppool on IIS