Sunday, January 16, 2011

Configuring htaccess to show authentication prompt only for subdomain

How do I write the htaccess so that it will only require authentication when on admin.example.com, but not on www.example.com (like by using some if-else clause)?

Background: I have a site running in two modes: The admin mode should be reached at something like admin.example.com, whereas the normal mode would be www.example.com -- but both should point to the same directory & scripts within them (the scripts then turn on certain editing features by checking if the script is accessed from the admin subdomain).

Edit: I can now see this has been asked and answered at StackOverflow, though I can't get the top answer to work for me...

  • Check:

    • that all the needed modules are installed
    • that all the directives can be used in .htaccess files.
    • The needed allowoverride settings are in the httpd.conf for the server to allow the use of .htaccess files
    From Craig

0 comments:

Post a Comment