问题
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.
Thanks!
回答1:
In the .htaccess file, just add
ErrorDocument 401 /401.html
And change 401.html to the name of the file you want to display.
来源:https://stackoverflow.com/questions/16479493/redirect-401-authorization-required-page-to-custom-page