How can I create .htaccess password protection firmware?

I just fiddled with setting up a password protected directory on my web server (to store hot backups, etc.) and was wondering if there was any way to create a password prompt style that pops up when a user tries access this page.

screenshot of the default prompt

As it stands, no one will notice my cute little note, which makes me sad.

my prompt

It seems like a standard .js warning, although I couldn't find a way to specify any css classes that I can change as the "alert" field is not showing in devtools, just the bahind it page:

screenshot of html source

Any advice / advice is greatly appreciated.

+3


source to share


3 answers


You cannot edit the authentication login window, it differs for each browser and is implemented as part of the browser internals (for example, the chrome code snippet related to the login name: https://code.google.com/p/chromium/codesearch# chromium / src / chrome / app / generated_resources.grd & q =% 22Authentication% 20Required% 22 & sq = package: chromium & type = cs & l = 3552 ).

What you can do is create a custom php login page (with a popover if you like):

Redirect 401 "required login page" to custom page



Custom login with htaccess via HTML / PHP

Replace htaccess popup with html form?

+5


source


Add this to .htaccess

ErrorDocument 401 /401.html

      



Then in your root directory (where your index.html is) make your own 401.html file. However, if you want to do the work with inputs, you will need a server-side language like PHP.

+1


source


From how to change the style of the alert box, you cannot change the style of the alert box unless you create your own alert dialog (see here for an example)

0


source







All Articles