Is there any way to create subdomain dynamically. All i want to do is to give each of my user a url like : www.username.sitename.com it as soon as user gets him/herself registered is there any way to do it , can anybody help me. Thanks in advance.
I think url rewrite will be easier than creating subdomain dynamically. you can take a look at here: http://check-these.info/mod_rewrite-basic.html Hope it will help you.
This is what I found to use.. and I'm posting it for anyone else who might need this snippet in the future: RewriteCond %{HTTP_HOST} !^w{3}\. [NC] RewriteCond %{REQUEST_URI} !^/userdir/ [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC] RewriteRule ^.*$ /userdir/index.php?user=%1 [L] Code (markup): Should go from http://user1.domain.com to http://domain.com/userdir/index.php?user=user1
Don't forget to enable wild-card sub-domains. If you are on a shared hosting, ask your server admin to enable it. The URL rewriting above will not work without it.