I am sorry if this question was already asked, but I do not know how to frame it differently - none of my searches found something that answers this.
I am currently using Windows 11 and XAMPP, with Apache 2.4.x and PHP 8.1.x, but the solution I am looking for will eventually run on a Linux (Ubuntu) server using same Apache and PHP versions.
Question:
I have two web addresses, say, https://test1.com
and https://test2.com
set up on my Windows Host file, that redirects to http://localhost/testapp
at the moment, which is a local PHP application.
Our goal is to have a session or flag or something set when you enter testapp from either domain, so that I have that information available within the PHP application. Since the redirect happens before we even get to PHP, I suspect the place to do this would be in Apache, and I would need to set and then retrieve the value of a $_SERVER
variable for the info, or something similar.
How can I achieve this? Can it be achieved?
$_SERVER['SERVER_NAME']
?SERVER_NAME
becomes something else. It does not containtest1.com
ortest2.com
.X-FORWARDED-FOR
header.