How to set up .htaccess file on Ubuntu 14.04 LAMP

Posted June 20, 2015 5.6k views
ApacheLAMP StackConfiguration Management

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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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.