How to Create a Password-Protected Web Site

by Contributor

A password-protected website means that only you and users you grant permission to can access it. There are services that will help you add password protection to your wesite either for free or for a fee. All you have to do is sign up and add some code to your homepage. Follow these steps to find out how.

Join a website that offers this service. Some are less secure and may not offer the exact protection you need. Others are more secure and may require a fee.

That website you joined will give you an HTML code to enter into your website. This may vary based on the program.

Look for a line in the script that reads "'userID.'" Change "userID" to whatever username you want.

Now look for a line in the script that reads "form.pass.value=='password.'" Change "password" to the one you want.

Now look for a line that reads "location='page2.html.'" This is the URL of the page that the person will be directed to once they enter the correct password. You may have to edit the path accordingly. If you're not sure, just put the complete URL of the page here.

The next step is optional. Look for a line that reads "alert('Invalid Password')." You can change "Invalid Password" to whatever message you want. For example, you can make it say, "The password you entered is incorrect. Please try again."

You can also do the same to the user Invalid ID section. Look for the line "alert('Invalid UserID')." Change "Invalid UserID" to whatever message you want to display when the username is incorrect.

That's it. You're finished!


  • check Try free services.
  • check Try multiple services to see which one is best for you.
  • check You can direct different people to different webpages. They won't realize other pages exist unless you grant them access.


  • close Make sure the code source cannot be viewed. If it can, someone will see the password
  • close Make sure the software you use is compatible with your OS.