URL Rewriting for user accounts
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/so开发者_运维知识库mepage.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?
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]
精彩评论