In my site i want to add an functionality for user to use their username with domain.
Like in codeigniter right now i want to give the user to use their own url to l
here's an explanation of your issue here. http://www.joehayes.org/setting-up-wildcard-dns-for-subdomains.html
Ok if you have read the explanation on the link, you'd know that you should redirect all of your subdomains to www first. in httpd.conf file there's a virtual host definition containing only yourdomain.com to redirect all the requests to your DocumentRoot.
**ServerAlias yourdomain.com**
ServerAdmin webmaster@yourdomain.com
DocumentRoot /home/yourdoma/public_html
BytesLog domlogs/yourdomain.com-bytes_log
ServerName www.yourdomain.com
User yourdomain
Group yourdomain
CustomLog /usr/local/apache/domlogs/yourdomain.com combined
ScriptAlias /cgi-bin/ /home/yourdomain/public_html/cgi-bin/
and you should modify the ServerAlias to *.yourdomain.com to retrieve all subdomains into your Document Root folder. then you should be able to mod_rewrite or url parse your uri to succeed this.