How to have an area of my website that visitors can only view with a password?

What are some easy ways to have an area of my website, or even the whole site, accessible only to visitors who know a password?

It would be OK if they all had to use the same password. The reason I want this is to be able to release the site to only a select few who are willing to beta-test it.

Thanks in advance for any help with this.


In the dreamhost panel visit: Goodies > Htaccess/WebDAV

Most of what you need to do there is self-explanatory, one note tho: you don’t want to check “Enable WebDAV on this dir?”, that is for something else and checking it will break your site.

.htaccess password protection of a is very simple. It should not be considered “security” in any sense. Passwords are sent in clear text. It’s best purpose today is for exactly what you want to use it for, keeping search bots and people out of a site, or portion of a site, that is under construction.

You can put a variable in your code and request it in the page_load action of the web page(s) that you want to restrict it.

Thanks for information

Thanks a lot

I have kinda the same question ! I want to add login option to my website. How can I add such option ? And is there any ready templates for that?

If you want to add a login option to a website then you should use a web app, such as wordpress, Joomla, etc etc that already has the framework for securely saving login information such as passwords and private information. On today’s internet “adding login” to a website is not a trivial task for a beginning level programmer. If you’re not a beginner then you already are aware of privacy concerns and the need to encode passwords and other private info that you store about a user.

If you just want a private place to experiment and your a dreamhost customer, see post 2 above. You can add some simple authentication to keep the avg noisy surfer out and keep your play space from getting indexed but search engines.