To begin with, sorry basically got the word 'pseudo subdomain' wrong. things i am attempting to achieve is-

When someone registers on my small application, they customize the url like.. yourname.myapp.tld

I shouldn't make use of the subdomain system with this. To become frank, I have no idea the way the subdomains exactly work however it guess it takes a folder per subdomain within the document root and so the server redirects the demands there.

Is this accomplished by doing something similar to -

whenever a visiter types any subdomain, (anything.myapp.tld), they can access myapp . Within the index.php file i'll explode the $_SERVER['HTTP_HOST'] to obtain the subdomain that we will store in session and can after that behave as an identifier for your user. Ideally i wouldnt are thinking about creating any vhosts or add many lines towards the hosts file. Is this accomplished with only one vhost?

Is possible with mod rewrite or something like that ?

You actually can archive this using wildcard that should be set up on, the dns server and http server

Around the dns a entry such as this (setting up dns on ubuntu https://help.ubuntu.com/10.04/serverguide/C/dns.html):

; wildcard subdomains are all directed to this IP
;  of course this should be the IP of your web server
*.domain.tld.      IN  A    1.2.3.4

At apache an entry such as this:

<VirtualHost 111.22.33.55>
    DocumentRoot /www/subdomain
    ServerName www.domain.tld
    ServerAlias *.domain.tld
</VirtualHost>

What goes on after is the fact that everything.domain.tld is going to be visiting your primary folder so that you can make use of the index.php to redirect it right place as well as an htaccess using mod_rewrite.