views:

50

answers:

1

We currently have domain.com/username redirected to domain.com/setsession.asp?u=username which then redirects to the app at domain.com/theapp.

This means users always see domain.com/theapp, so browsing to a page shows domain.com/theapp/somepage.asp

Looking to move this to subdomains ie

username.domain.com

(we'll get the host name and work out the user from that). How can this be set up? Should we move the app itself to say theapp.domain.com and then rewrite username.domain.com to theapp.domain.com and everything works?

If thats right, how can we do the URL rewrite (mod_rewrite via ISAPI Rewrite for IIS or URL Rewriting for IIS) so that we can still access webmail.domain.com, etc?

A: 

If you just want to move domain.com/username to username.domain.com, you can do this with mod_rewrite:

RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule .* http://domain.com/setsession.asp?u=%1 [B,R=permanent]
Artefacto
Thanks but its not quite what I was after, solution is over at ServerFault: http://serverfault.com/questions/143442/using-iis-url-rewrite-how-to-rewrite-foo-bar-com-bar-com-myapp
Igor K