0

I have 4 websites :

  • 1 "root" domain : tooliphone.net
  • 3 sub-domains, one for each "app/service" : iempty.tooliphone.net, icustom.tooliphone.net and iskin.tooliphone.net

Today, I'd like to duplicate these 4 websites to create a "beta testing" environment where I can publish beta versions of upcoming features for each service, and make it accessible to some selected users for beta testing / early access purpose.

So I need to protect access to these beta websites with basic credentials (login / password). The easiest way seems to be a simple .htpasswd file and .htaccess configuration

So I created 4 new sub-domains : beta.tooliphone.net, beta.iempty.tooliphone.net, beta.icustom.tooliphone.net and beta.iskin.tooliphone.net

In each website, I've put this on top of the .htaccess file

AuthUserFile /path/to/my/htpasswd/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted BETA area - TooLiPHoNe.NeT"
AuthType Basic
<Limit GET POST>
    require valid-user
</Limit>

This works, I'm prompted to enter the user/password for each website (same user/password as this points to the same htpasswd with only one user into it).

But I'd like my beta users to enter only ONCE the credentials to access all the 4 beta websites.

For example :

  • a user go to beta.iempty.tooliphone.net
  • he enter the beta credentials and get access
  • then he go to beta.iskin.tooliphone.net or beta.tooliphone.net
  • he doesn't have to enter again the credentials and he is not prompted for that

This is also important because for example when he visits the root website beta.tooliphone.net, I have links on the first page to icons of the other websites.

The result is that a user visiting the root domain is prompted 4 times to enter the same credentials! One to access the root website, the others to display the other websites icons.

This is not really "user friendly" ! :)

How can I achieve to "share" the entered credentiels in one of the 4 websites with all?

Thanks in advance for your feedbacks

TooLiPHoNe.NeT
  • 479
  • 1
  • 5
  • 22
  • You're not going to be able to do this with HTTP (Basic) Authentication since the _browser_ won't send the `Authorization` header when requesting a different hostname (or URL-path) to the one previously authenticated on. – MrWhite Oct 22 '20 at 17:48
  • OK thanks... any alternative using a different system? I'm on a shared hosting (OVH provider) and don't want to develop a full login system just for that purpose... – TooLiPHoNe.NeT Oct 23 '20 at 01:45
  • 1
    I managed to achieve what I want using a different approach... my beta users already have a special cookie so I test it in my PHP code and redirect the user if on a "beta" sub-domain AND he dones't have the cookie I look for – TooLiPHoNe.NeT Oct 23 '20 at 03:09

0 Answers0