Hello. There is a site.ru site and a sub.site.ru subdomain, you need to show site.ru site when entering through a subdomain and it says on which subdomain a person entered That is, in this case: "You entered through the subdomain sub". But I can not figure it out to open the main site through the transition to the subdomain.
|
3 answers
We look at the answer of @Gedweb and set it in the site's alice *
so the site will be accessible by any subdomain you like.
Further, for example, such a script:
$site_url = 'site.com'; if($site_url != $_SERVER['HTTP_HOST']) { $subdomain = preg_replace('/(.*).'.$site_url.'/', '$1', $_SERVER['HTTP_HOST']); echo 'Вы зашли через поддомен ', $subdomain; }
|
php nothing to do with, this is server setup
|
in sub.site.ru only one line is needed
# index.php
header('Location: http://site.ru/');
and from which subdomain went to site.ru can be found using:
$_SERVER['HTTP_REFERER']
- ... this is if the browser or antivirus does not cut referrer. - VladD
- this is how you want to slap a minus, but how will the client get to the script with the code you specified? Share your sacred knowledge - Gedweb
- script, as I understand it, the default - ArcherGodson
- If you do not know what you are talking about, it is better to pass by. No need to mislead anyone, and by the way, too ... ---------- you propose to create over9000 subdomains with redirects, this is a completely wrong approach - Gedweb
- 2Well .. I was knocked down "But I can not figure it out to open the main site through the transition to the subdomain.". yes, I am probably wrong. - ArcherGodson
|