# Apache .htacess not working properly (SOLVED)

## JC99

Hello everyone,

I'm having a problem with an .htaccess file. Right now I have it setup as follows...

example.com/directory/.htaccess

...when I visit example.com it asks for an username and password but it shouldn't

I want it setup so when I visit example.com/directory/ it asks for a username and password.  Anyone know whats wrong or why it's acting this way?

ThanksLast edited by JC99 on Sun Aug 19, 2012 12:14 am; edited 1 time in total

----------

## zoidie

The only thing I can think of is that you have accidentally copied the .htaccess file to a the root directory of the server.  The only way I could recreate this behaviour on my test server was copying the .htaccess to /var/www/localhost.

If not that, what is the contents of your .htaccess file?

----------

## JC99

I checked all the directories and the .htaccess is in the right place. Here are the contents of my .htaccess

 *Quote:*   

> AuthType Basic
> 
> AuthName "Directory"
> 
> AuthUserFile /home/.htpasswd
> ...

 

----------

## destroyedlolo

Did you double/triple check Apache's global configuration ?

----------

## JC99

I changed the name of the directory and now it's working. Strange. Don't know what the problem was. The folder was called apps and I renamed it applications

----------

## destroyedlolo

I'm quite sure it's because you have somewhere in your Apache global configuration files a reference to "apps".

Worth a check   :Smile: 

----------

## JC99

I completely removed apache from my system including all files in /etc/apache2. I then reinstalled apache and ran into the same problem. Doesn't make any sense to me.

----------

