Is there a way to differentiate the statuscode 401 of a page pre authentification and after closing the promtp?

Viewed 17

so i have a webpage with a login section. Login is done with .htaccess and .htpasswd file. That works fine. Now i need to style or customize the "unauthorized" page that results after closing the authentification prompt.

Here is my problem: If I request the page, .htaccess kicks in and wants me to authenticate, resulting in a status code of 401. But if I close the promt, I get the "Unauthorized This server could not verify that you are authorized..." response with an status code of also 401 back.

Question: Is there a way to differentiate the statuscode 401 of a page pre authentification and after closing the promtp?

1 Answers

You might want to look at the documentation for this.

perhaps also set the 401 document

ErrorDocument 401 "/login.shtml"
Related