Article:
  Apache Web-Serving with Mac OS X, Part 4
Subject:   Almost, But Not Quite: .htaccess
Date:   2002-04-06 07:16:45
From:   jgbutler
Thanks for a very informative series. It's been a great help to me and just about convinced me to dump MS IIS and move on over to Mac OS X with Apache!


One thing, though...


I've ALMOST got that ding-dang .htaccess deal working, but not quite. Perhaps you can see what I've missed...


After successfully making .htpasswd, I created a .htaccess file with the following in it:


AuthName "Uber Goober Ad Campaign"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require valid-user


I put .htaccess in /Library/WebServer/Documents, but it has no effect. Index.shtml is served up and no authentication is requested when the server is accessed.


I'm pretty sure I've got .htpasswd correctly built cuz authentication WILL work for the ENTIRE Website if I put the Auth lines in httpd.conf.


I should also mention that httpd.conf contains the following:


<Directory "/Library/WebServer/Documents">
Options FollowSymLinks MultiViews Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>


Thanks for your help!


--Jeremy Butler

Full Threads Oldest First

Showing messages 1 through 4 of 4.

  • Almost, But Not Quite: .htaccess - SOLVED!
    2002-04-11 09:37:05  jgbutler [View]

    I finally solved the mystery!

    The culprit: BBEdit!

    I used BBEdit to create a new .htaccess file cuz I didn't know nuthin bout no pico or vi or whatever. I had been using BBEdit to change httpd.conf and such and it worked just fine, but unbeknownst to me it had created .htaccess with MAC-style line-breaks, not UNIX-style ones.

    The bastid!

    I guess cuz httpd.conf was a pre-made file it already had Unix line breaks and BBEdit kept it that way, but when I created a NEW file, it decided that Mac line breaks would be ever so much nicer. I only figured this out after poking around in BBEdit's "save as" options. Once I changed the "save as" to Unix line breaks, password authentication began working like a charm.

    I guess the Mac-Unix convergence ain't exactly all converged and such.

    --Jeremy
    • Morbus Iff photo Almost, But Not Quite: .htaccess - SOLVED!
      2002-04-16 17:20:08  Morbus Iff | O'Reilly Author [View]

      Jeremy,

      I'm a huge fan of BBEdit. It only makes sense for a Mac application to default to Mac line feeds when it creates a brand new document. Note, however, that if you don't like this behavior (as I didn't), then you can tweak the "new file" settings. Under BBEdit 6.5, this is under Preferences > Text Files: Saving and Default Line Breaks.

      Don't be so quick to blame BBEdit ;)
      • Almost, But Not Quite: .htaccess - SOLVED!
        2002-05-02 09:16:37  naclay [View]

        About BBEdit... I cant save a file with a "." as the first character in the file name. i.e. I can save a file as "htaccess" but not ".htaccess". Is there some other option I need to change?

        -NC
        • Almost, But Not Quite: .htaccess - SOLVED!
          2002-07-15 13:27:06  jgbutler [View]

          This is addressed in the BBEdit FAQ at

          http://www.barebones.com/cgi-bin/faq/faqgroup.pl?BBEdit_General#General_-_12

          You might also want to look into TinkerTool, which will make "dot" files visible in Finder.

          Regards,

          Jeremy