This is one of the most frequent questions I get: "Can I protect part of my web site with a password?" Yes you can, and there are a number of ways to do it, depending on what kind of protection you need.How to do it:
Here's a simple and very effective method: create a web page whose name is the password. If your password is "lazysnake", create a file called lazysnake.html on your web site. As long as you don't link to lazysnake.html from any of your public documents, no one will be able to find it (not even the search engines)! There is generally no index of documents available for a whole web site. If you don't tell someone where you keep your protected file, they won't be able to access it.
This method is nice because the password isn't stored in any form on the entry page. An intruder can look at the page source, but they won't be able to find the password. Want to try it out? Here's an example--the password is "lazysnake".
By the way, if you were to copy the above code exactly, and if you typed "lazysnake" as the password, you'd be sent directly to "http://www.changethis.com/~you/lazysnake.html". To avoid this, you'll need to change the first part of this URL (in the code) to match your own web site address. Then, once the correct password is typed in, the location.href will contain the complete URL of your protected document, and the user will be sent to the protected page.Alternatives: