0

I'm trying out WinHost and I'm running into some issues with sub-domains. On WinHost, you can have multiple sub-domains per hosting account, but each sub-domain points to the root website. E.g. you can have www.example.com, sub1.example.com, and sub2.example.com but all of them display the content at http://www.example.com/.

Other Hosts allow you to point sub-domains to a sub folder in your website. This would allow you to point sub1.example.com to /sub1, sub2.example.com to /sub2 and www.example.com to /.

WinHost recommends using an asp/aspx page to redirect http://sub1.example.com to http://sub1.example.com/sub1, which points to /sub1. While that would work, I'd like to not have the subdomain in the url twice.

So I tried using IIS7 URL Rewrite to point http://sub1.example.com to /sub1. Ben Powell describes this in detail on his blog. This is great, except Request.ApplicationPath is now /sub1/path/to/current/page.aspx, which breaks ASP.Net Themes (and probably other stuff too).

What can I do to fix the ApplicationPath? Is there a better way to accomplish this?

jrummell
  • 42,637
  • 17
  • 112
  • 171
  • I haven't been having a problem with this, though I have mostly been using MVC with WinHost, could you post the rule you were trying to do the redirect with? – Sean Lynch May 07 '10 at 20:33
  • See the first code snippet on my blog post about this: http://john.rummell.info/john/blog/post/WinHost-Sub-Domains-and-IIS-7-URL-Rewrite.aspx. I'm using WebForms with .NET 3.5. – jrummell May 08 '10 at 19:40

3 Answers3

1

I tried my luck on serverfault. No helpful answers there either, but I did post my solution:

I couldn't figure out how to fix the application path, so now I'm simply using the URL Rewrite Module to redirect (not rewrite) from http://sub.example.com/abc to http://sub.example.com/sub/abc. It's not ideal, but it works. See my blog post for the details.

https://serverfault.com/questions/134125/how-to-manage-sub-domains-on-winhost-with-iis7-url-rewrite-2-0/135533#135533

Community
  • 1
  • 1
jrummell
  • 42,637
  • 17
  • 112
  • 171
1

Altaf's article explained the resolution by removing the ~ sign. Look at the point 7 there.

  • Right, I want to avoid that. I use `~/relative/path` every where in my app so that it doesn't matter whether I place the app in the site root or any arbitrary virtual directory. – jrummell Apr 08 '11 at 12:41
0

Winhost.com – How to REALLY run multiple sites under one account see below url

https://benpowell.org/winhost-com-how-to-really-run-multiple-sites-under-one-account/?unapproved=31073&moderation-hash=8d58e661f6d4dafcd93335a0a837b193#comment-31073

Amila Thennakoon
  • 419
  • 1
  • 5
  • 15