Welcome Guest, Not a member yet? Register   Sign In
Basecamp like Urls *Permalinks*?
#4

[eluser]Jamongkad[/eluser]
[quote author="champs" date="1190760557"]Nothing magical or Rails-specific about it.

First, you need wildcard DNS set up, a web server willing to accept all the hostnames, and just a couple lines of PHP in your controller:

Code:
<?php
// like, such as, 'maps.example.com'
$host = strtolower($this->input->server('HTTP_HOST'));

// and now we'll get: array('maps', 'example', 'com');
$account = explode('.', $host);

// if there's a subdomain, and it's not 'www'... then that's the account name.
$account = (count($account) > 2 && $account[0] != 'www') ? array_shift($account) : false;
[/quote]

Thanks man, would this script be inserted into a function? Also would this mean that your webserver I assume allows a WildCard DNS?


Messages In This Thread
Basecamp like Urls *Permalinks*? - by El Forum - 09-25-2007, 08:54 AM
Basecamp like Urls *Permalinks*? - by El Forum - 09-25-2007, 09:17 AM
Basecamp like Urls *Permalinks*? - by El Forum - 09-25-2007, 11:49 AM
Basecamp like Urls *Permalinks*? - by El Forum - 09-25-2007, 09:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB