Benches macOS

12

htaccess ignored on local server?

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hey y'all,

I'm trying (for testing purposes) to set up a redirect with .htaccess, from my local Apache , but it seems as if my .htaccess is just ignored.

_For example:_

I would like to redirect

+
http://localhost/+

to

+
http://www.apple.com/+

This is the content of my .htaccess (stored in /Library/WebServer/Documents):

*redirect /
http://www.apple.com/*

The changes I made in /etc/httpd/httpd.conf are:

*<Directory />*

*Options FollowSymLinks*

*AllowOverride All*

*Order allow,deny*

*Allow from all*

</Directory>

and

*<Directory "/Library/WebServer/Documents">*

*Options Indexes FollowSymLinks MultiViews*

*AllowOverride All*

*Order allow,deny*

*Allow from all*

</Directory>

I guess I'm missing something forehead-slapper simple, but it seems as if my .htaccess is just ignored. Any idea what I'm doing wrong?

Thanks!

12 replies

Sign in or join Beachball Help to reply.

  1. 0

    Jeff Breitner

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Have you tested any of the other .htaccess functions to confirm that the .htaccess files are not being ignored, like say asking for a password? That'll help narrow it down to an error in your .htaccess file or an Apache config problem.

    Remember to completely restart Apache after each config file change.

  2. 0

    Koinseb

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi Jeff,

    thanks for your reply!

    Yes, I tried password protection as well (and restarted the server), but it was ignored 😟

  3. 0

    Community User

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I am also having the same problem. I cannot get password protection to work for my local webserver. This seems very straightforward; but I don't know what's wrong. Have you found a solution yet?

  4. 0

    Koinseb

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Nope, sorry. Still no solution.

    I just didn't have the time to keep tinkering with it, so I used a Linux machine for my tests and it worked right away...

  5. 0

    Jeff Breitner

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Sorry for the absence in the thread, was working far away from a computer for the past several days (in the rain and snow).

    Does error_log or access_log show anything? Did you install Apache from source or did you use a default Apple installation?

  6. 0

    Koinseb

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi Jeff,

    now I have to apologize for my long absence from this posting. Work sometimes gets in the way of life...

    I'm using the default Leopard installation.

    I just re-started Apache and then accessed the site. What I have in the error log is:

    +[Tue Nov 27 10:43:40 2007] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]+

    +[Tue Nov 27 10:43:41 2007] [notice] Digest: generating secret for digest authentication ...+

    +[Tue Nov 27 10:43:41 2007] [notice] Digest: done+

    +[Tue Nov 27 10:43:41 2007] [notice] Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2 PHP/5.2.4 configured -- resuming normal operations+

    The access log doesn't look too exciting:

    +127.0.0.1 - - [27/Nov/2007:10:44:58 -0500] "GET / HTTP/1.1" 200 1456+

    +127.0.0.1 - - [27/Nov/2007:10:44:58 -0500] "GET /apache_pb.gif HTTP/1.1" 200 2326+

  7. 0

    ryan.

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Any update on this? My Leopard web server is also not reading .htaccess files by default. Apache did previously on my Tiger workstation install.

  8. 0

    keith.wilson

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Forgive me if I'm stating the obvious, but doesn't Leopard use Apache 2 by default, and so any changes you make to httpd.conf will need to be applied to /etc/apache2/httpd.conf? This doesn't explain why Apache isn't reading your .htaccess file though, although I was never able to get this working under Tiger either, so do let me know if you find a solution.

    - Keith

  9. 0

    Koinseb

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Duh!

    That was a true forehead-slapper!

    Yes, you stated the obvious: I had obviously edited the wrong httpd.conf.

    I made the same changes I mentioned in my original post to /etc/apache2/httpd.conf, restarted the server and it works. I can redirect or password protect the site using .htaccess.

    So, yes this did explain why Apache wasn't reading my .htaccess - at least in my case. Hopefully it's the solution for others in this thread as well...?

  10. 0

    keith.wilson

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Actually, I just tried this on my own Leopard installation and changing the AllowOverride option to All seems to have done the trick. The .htaccess files under /Library/WebServer/Documents are now being recognised without any problems! Hope this works for you too...

  11. 0

    ryan.

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks guys for getting me in the right direction. I tried the AllowOverride in httpd.conf in the (now) correct directory and still didn't work. So then I though, I've setup everything through the interface in server admin, why would I have to manually dig in the conf files now? Went back to server admin, and on the options tab of the site I created there is an "Allow All Overrides" box. Ticked, done! Can't believe I missed that, but my brain is too use to config files.

    Cheers!

  12. 0

    Ninestein

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Keith, you are a life saver. Thanks! Been scratching my head a little too hard to solve that one. Now have the htaccess file working and the mod-reqrite plugin.