If User Coming From Specific Web Site (Links) Skip Basic Auth

Hi All,

I am new to Apache and need help to configure Basic Auth Exception. We have a web site (site1) with a specific folder having static files, protected with Basic Auth. We also have the 2nd web site (site2) and we want to add the exception to the Basic Auth rule of site1 that if user is coming from site2 (having hyperlink on that site web pages) then skip the Basic Auth for site1, otherwise always prompt user for the Basic Auth on site1. Only hyperlinks from site2 web page will skip the Basic Auth.

Here is the Apache 2.4 .htaccess file from site1, but it’s still prompting for Basic Auth, when click from site2 link to access static folder hosted on site1.

=================================================
# Basic Auth 
AuthType Basic
AuthName "Password Protected"
AuthUserFile "/home/abc/.htpasswords/passwd
Require valid-user

SetEnvIf Referer "^https://www\.xyz\.com$" valid
Order Deny, Allow

# Allow Valid User
Deny from all
Allow from env=valid
Satisfy any
=================================================

Thanks
SauGo