How to set up .htaccess file on Ubuntu 14.04 LAMP

June 20, 2015 4.6k views
LAMP Stack Configuration Management Apache

I’ve read all the posts on here as well as StackOverflow and even watched a few YouTube videos on how to set up an .htaccess file (I’m trying to password protect my directories) and none of them are working for me. Everything I do creates a 500 Internal Service Error message.

Do I need to change the 000-default.conf file or the apache2.conf file and what do I need to change? Is there anything else I need to do after that (besides setting up the .htaccess file and .htpasswd file)?

Can someone please provide a fresh step-by-step guide on how to set this up?

P.S. Sorry for the whining, I’ve been at this for 3 days and feel like I’m taking crazy pills!

1 Answer

Hey there,

This tutorial outlines all the step for using the .htaccess file for authentication purposes. The error log at /var/log/apache2/error.log would also a good place to look for more information on the errors you are receiving.

Happy coding,

Jon Schwenn
Platform Support Specialist

by Etel Sverdlov
This tutorial covers five common uses for the .htaccess file. These include: Mod_Rewrite, Authentication, Custom Error Pages, Mime Types, and Server Side Includes.
Have another answer? Share your knowledge.