Hello, I am developing a site on which upon registration the users will receive a personal site with the address

username.domainname.com

Please tell me how this can be achieved, I think it might b possible with the use of mod_rewrite but I am not sure.

Please help me with this problem.

Thank You

First .htaccess file:

RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domainname\.com$
RewriteRule ^$ /index.php?user=%1 [L]

Second, we must set a redirection from whatever "username.domainname.com" link to "domainname.com". Thats achieved by talking to your hosting provider to setup such a redirect.

Third, according to your site link generation, modify the last line in .htaccess provided lately. In my case it was "index.php?user=1", which was transformed to 1.domainname.com.

First .htaccess file:

RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domainname\.com$
RewriteRule ^$ /index.php?user=%1 [L]

Second, we must set a redirection from whatever "username.domainname.com" link to "domainname.com". Thats achieved by talking to your hosting provider to setup such a redirect.

Third, according to your site link generation, modify the last line in .htaccess provided lately. In my case it was "index.php?user=1", which was transformed to 1.domainname.com.

Thank You AMD_K8, I will give it a try.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.