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?

  • 1
    What sort of webserver are you using? Apache? IIS? May 10, 2011 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, 2011 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. May 10, 2011 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, 2011 at 10:15
  • To make this question useful to other people I've answered it for people using IIS too. May 10, 2011 at 10:37

1 Answer 1


First of all find out what sort of webserver you are using by using the method suggested in this question: https://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 https://serverfault.com/questions/193273/iis-password-protection-for-php

  • Dear Paulmorriss, thank you very much for your great help. Is solves my problem. :-)
    – Anand
    May 10, 2011 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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