I am creating static html page. By static I mean that there will be no html content dynamically generated by server. Just a set of .html files.
I want to force users who want to display the page to enter username and password (or at least the password). Those who do not enter correct password will not be allowed to enter the site. The password (and username) can be single (only one existing correct username and password combination). The protection does not have to be super safe, just enough to keep random surfers, Google bots and such out.
How can I do that?
Use .htaccess , but note that this way you won't be creating your own login form, it will be a browser popup. Read this on how to use .htaccess to password protect your pages, http://www.elated.com/articles/password-protecting-your-pages-with-htaccess/
Use an .htaccess
file. This will make the browser create a popup to enter a username and password. If the password authentication fails, the server gives a 403 Forbidden page.
I normally see these used in conjunction with Apache servers, but this could change depending on your hosting provider or if you're even using an Apache server at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With