Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing some simple HTML pages. I need to protect some pages and some files (from being downloaded) by requiring a username and password. Does anyone know a simple solution?

share|improve this question
What sort of webserver are you using? Apache? IIS? – paulmorriss May 10 '11 at 9:20
I don't know actually. I can connect to the server to upload my files there. Besides that, I don't think that I could have other access to the server. Thank you! – Anand May 10 '11 at 9:28
Do you want to use Netcraft as suggested in this question superuser.com/questions/120783/… to work it out and then tell us the results. – paulmorriss May 10 '11 at 10:10
Here is the result: Thank you! HTTP/1.1 200 OK Date: Tue, 10 May 2011 10:14:35 GMT Server: Apache/2.0.52 (Red Hat) X-Powered-By: PHP/4.3.9 Connection: close Content-Type: text/html; charset=UTF-8 – Anand May 10 '11 at 10:15
To make this question useful to other people I've answered it for people using IIS too. – paulmorriss May 10 '11 at 10:37
up vote 5 down vote accepted

First of all find out what sort of webserver you are using by using the method suggested in this question: http://superuser.com/questions/120783/can-i-detect-what-webserver-a-website-is-using

If it's Apache How do I setup authentication on a specific folder using .htaccess?

If it's IIS http://serverfault.com/questions/193273/iis-password-protection-for-php

share|improve this answer
Dear Paulmorriss, thank you very much for your great help. Is solves my problem. :-) – Anand May 10 '11 at 11:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.