Reliability php HTTP_HOST & HTTP_REFERER for a critical task

I am going to create a website in PHP. But not sure if the method I'm going to use is the best approach. On one site there will be many addon domains. But the content will be filtered based on the domain used to visit the site.

For example, if a user comes from the siteusa.com domain, then the content will be displayed accordingly. If the user comes from siteuk.com/sitechina.com, the content will be transferred accordingly, etc ...

I plan to do something similar to detect the url and serve the content

 $ref = getenv("HTTP_REFERER");
    echo $ref; 

or

$host = $_SERVER['HTTP_HOST'];
echo $host ;

Is this the best way to do this? Is there a possible bottleneck I can get into? This should not interfere with determining the domain as critical.

, .

, codeigniter .

+3
1

HTTP_REFERER - . HTTP_REFERER , .

HTTP_HOST/SERVER_NAME , .

, . (, apache virtualhosts), ENV VirtualHost .

+2

Source: https://habr.com/ru/post/1768832/


All Articles