CodeIgniter Forums
getting subdomain url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: getting subdomain url (/thread-27299.html)



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.