Simple script I made the other day that will generate the exact code you need to password protect a directory. Path is set for a plesk user’s httpdocs folder but can be modified as needed.
Server Monkey is looking for tutorial writers to join our staff. Interested applicants can send a quick introduction of themselves to apply@server-monkey.com