CodeIgniter Forums
getting subdomain url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: getting subdomain url (/showthread.php?tid=27299)



getting subdomain url - El Forum - 02-06-2010

[eluser]vineetyadav[/eluser]
hi,
i am working on application that uses user pages.
forexample if my site is example.com
i have set cname record *.example.com -> example.com
now, suppose if john opens, johnMcCain.example.com, i need to get value johnMcCain from url.

can some one help, please, its urgent


getting subdomain url - El Forum - 02-06-2010

[eluser]bretticus[/eluser]
in plain ole php...

Code:
$host = $_SERVER['HTTP_HOST'];

From there you parse the url.