Web Design and Hosting Creating sites, scripting, and hosting discussions.

htaccess file is not working


Post Reply New Thread Subscribe

 
Thread Tools
gamblor01

 
Member Since: Mar 22, 2009
Posts: 6
gamblor01 is on a distinguished road

gamblor01 is offline
Hi folks...I'm migrating a web server from Ubuntu to OS X (10.6) and have everything with PHP/MySQL up and running but for some reason the .htaccess file isn't working. Here is what I did:

1. Ran the htpasswd command to create the new user
2. Placed the following .htaccess file in the directory I want to protect:

Code:
AuthUserFile /Users/webuser/.htpasswd
AuthType Basic
AuthName "Private stuff!"
require valid-user
3. Modified /etc/apache2/httpd.conf and set the AllowOverride command inside of my <Directory> tags to be AuthConfig.

4. Restart with "sudo apachectl restart"


I'm not sure why but the changes don't seem to have any effect. Browsing to the "protected" URL doesn't prompt for any credentials and instead it loads the page up right away. Anybody know why this isn't working?
QUOTE Thanks
JasCal

 
Member Since: Jan 17, 2011
Posts: 5
JasCal is on a distinguished road

JasCal is offline
Why did you place it in the directory you want to protect?

I like to use only one htaccess file per site, always keep it at the root level of the site.
QUOTE Thanks
gamblor01

 
Member Since: Mar 22, 2009
Posts: 6
gamblor01 is on a distinguished road

gamblor01 is offline
I placed it into a subdirectory because I don't want to protect the entire site with a password. There are other files that I specifically WANT people to be able to access. There are also files that shouldn't be accessible by everyone.

The placement of .htaccess isn't the issue here I can promise you. Once placed in a directory it should prevent access to that and all sub-directories (recursively). The point is that the Apache server on OS X doesn't seem to be responding to my use of .htaccess and I don't know why.
QUOTE Thanks
gamblor01

 
Member Since: Mar 22, 2009
Posts: 6
gamblor01 is on a distinguished road

gamblor01 is offline
Ok I figured it out. I was getting so frustrated that I eventually just ran this:

Code:
$ cd /etc/apache2
$ grep -rni "allowoverride" .
As it turns out, there is a separate config file for your username under /etc/apache2/users. The "AllowOverride" option was set to none there. As soon as I changed this to All and restarted apache everything is working just fine!
QUOTE Thanks

Post Reply New Thread Subscribe


« bought a domain | website design »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Weird file size issue Ramen Tetsujin OS X - Operating System 0 07-21-2009 12:49 PM
Info.plist to *open* a file gamblor01 OS X - Development and Darwin 2 03-22-2009 11:00 PM
video file core20 Switcher Hangout 0 05-19-2007 05:13 PM
File copying frustrations - help? djmitch Switcher Hangout 5 06-27-2005 01:23 AM
Can you guys open this site? Desolate One OS X - Apps and Games 13 04-29-2005 01:23 PM

All times are GMT -4. The time now is 10:35 PM.

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?