Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static html page with authorisation (password protection)? [closed]

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?

like image 569
Rasto Avatar asked Oct 07 '22 13:10

Rasto


2 Answers

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/

like image 118
Alex Terletskiy Avatar answered Oct 13 '22 12:10

Alex Terletskiy


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.

like image 29
Polyov Avatar answered Oct 13 '22 12:10

Polyov