views:

48

answers:

1

Is there a way of creating dynamic URLs so when someone access my site with ####.example.com the #### would be a key of where to go.

I know Elance does it with usernames, instead of www.elance.com its username.elance.com

+1  A: 

If you're using apache, with something like this in your htaccess, your 'dynamic subdomain' should work:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.yourDomain.com
RewriteCond %{HTTP_HOST} ([^.]+)\.yourDomain.com
RewriteRule ^(.*)$ /public_html/profile.php?userid=%1

Then when you write http://KPheasey.yourDomain.com, this request will be handled by profile.php with a userid get parameter (value = KPheasey).

If you are using IIS, you can find something similar here

Matias