Quick Tip to New Web Dev’s

My First Web Server

Development is hard enough without having hackers and jerks playing around in your code. I only recently brought my webserver back on the web and in doing so I have made a few changes to the architecture to be able to freely share my development process with the world, but protect parts of it that I use when im out and about without having to be too intrusive.

Todays tip is the .htaccess file that many of you may be taking for granted or ignoring. The primary purpose of this file is to direct your apache server to conduct some form of authentication before providing what has been requested, and possibly dropping out if they request something they don’t have access to.

Create a new text file named .htaccess and drop the following blurb into it.

AuthUserFile /path/to/passwd
AuthName "Development Server"
AuthType Basic
require valid-user

Now save that and open up a terminal on your host (this is the easier way to handle it without having to actually touch the file with your own hands. Execute the following command…

htpasswd -m /path/to/passwd username

You will then be prompted for the password for this user and the file will be updated to allow this user to gain access to the .htaccess protected directory. You may have to add the -c flag if you are creating a new passwd file, but in all other circumstances you dont need to provide it.

If you are so inclined please feel free to visit My Development Box to see what is being worked on currently in my offline projects. This site will be evolving over time, to reflect my current load more appropriately and probably some form of jquery or flash interaction because that has been ignored over the last couple years and my portfolio has been diversified quite a bit beyond what most of my clients have realized.