Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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
share|improve this answer

Try setting up a virtual host for the admin interface and adding the authentication configuration to a Location section inside it. Or just configure it for the whole virtual host.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.