.htaccess authentication for 2 servers

Posted on 2006-06-04
Last Modified: 2010-03-04
Hello there,
    I was wondering if it was possible to join .htaccess auth on 2 servers. Such as, if someone had gone to server A, entered their log/pass, could they go to a .htaccess protected directory on server B without needing to re-enter (the same log/pass) again for that server.


Question by:undinism
    LVL 57

    Expert Comment

    Are these physically two unique server or are they the same sever just different virtual hosts?

    Author Comment

    2 physically unique servers. Both are located on the same LAN that is connected to the net.
    LVL 15

    Expert Comment

    I don't know of a way that they wouldn't have to re-enter the informaton on server 2; however, if the second server was entirely script driven, it isn't hard to pass the user id to the second server.  You could do so with a small script like:

    use CGI qw(:standard);
    $userid = $ENV{'REMOTE_USER'};
    LVL 15

    Expert Comment

    Let me clarify my statements.  I don't know of a way that they wouldn't have to re-enter the information using strictly .htaccess commands;  if the second server was completely script driven, though, you could pass the userid information from the first server to the second one using a script like the one that I mentioned above.
    LVL 10

    Accepted Solution

    You can span authentication across different servers by using Digest authentication.

    See in particular the AuthDigestDomain directive.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now