Configuring htaccess to show authentication prompt only for subdomain

Posted by Philipp Lenssen on Server Fault See other posts from Server Fault or by Philipp Lenssen
Published on 2009-09-17T15:30:36Z Indexed on 2010/04/14 3:03 UTC
Read the original article Hit count: 280

Filed under:
|

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...

© Server Fault or respective owner

Related posts about htaccess

Related posts about authentication