1. According to said
return 301 https://site.com/index.php?styleid=6;
That is the last line opens the forum in a mobile version.
you have turned register_globals=On
, so when entering the url https://site.com/index.php?styleid=6
; automatically set the variable $styleid = 6;
. But if you go to https://site.com/index.php?styleid=3
- it is established in 3
If so, not only are you in danger
, you still works all on the verge of a foul. If hoster will turn off register_globals or switch to PHP >= 5.4.0 - you will turn off the mobile version.
In the search results the mobile version of the site, you will not m.site.com
, that is not good.
2. If you have mobile and desktop vesriya website are processed by the same engine, config virtual host should be:
server_name site.com www.site.com m.site.com www.m.site.com;
that is, all domains have to register one virtual host. Then you will have a corresponding $_SERVER['HTTP_HOST']:
- if you go to site.com
- if you go to www.site.com
- if you go to m.site.com
- if you go to www.m.site.com
Now config your virtual hosts just redirects m.site.com
that is to go to the mobile version simply impossible.
3. I would not trust $_SERVER['HTTP_HOST']
- sends it to the user that is fraught with problems
and can be unsafe
I always rely on $_SERVER['SERVER_NAME'], but that it always correctly showed the domain/subdomains - in site config for Apache it is necessary to register UseCanonicalName On
. What is prescribed for the nginx server - I don't know, maybe he and so displays it correctly.
UPD: I got excited. Here it is necessary to use $_SERVER['HTTP_HOST'] because $_SERVER['SERVER_NAME'] will depend on the settings of the web server, and may not show m.site.com
if he is hanged by the alias...