R – Is it possible for separate IIS/SharePoint web applications to share the same host name but different relative paths

iissharepointweb-applications

When setting up a SharePoint farm, is it technically possible to use the following URL structure?

http://myfarm/webapp1
http://myfarm/webapp2
http://myfarm/webapp3
etc.

where each URL points to a different web application on the same farm/server.

Best Answer

MDRoz,

Generally speaking, the answer (in a vacuum) is "no." As far as SharePoint is concerned (or rather, IIS), a hostname without any qualifying port information can be mapped to one IIS website.

Now that I've said that: there are variety of creative ways you might address this, and most are going to involve URL re-writing and remapping. A couple of ideas that come to mind:

  1. A wonderful URL rewrite module can be obtained for IIS 7 that might work for you as-is (http://www.iis.net/extensions) ... assuming you're on Windows Server 2008, of course.

  2. You could probably leverage Microsoft ISA Server 2006 to map incoming requests to different SharePoint web applications (IIS websites) based on path information. I don't have an ISA admin console open in front of me right now to explicitly confirm that, though.

  3. You could develop an HttpModule that rewrites incoming URLs so that they are redirected or handled by different sites/web apps. This would ensure that redirection logic is specifically what you want.

Another link that might have some helpful tidbits comes from Todd Klindt, SharePoint MVP and all-around nice guy: http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=48.

Regardless of the route you choose, I'll point out one potential sidenote and watchout: hierarchy and path depth. Generally speaking, any rewriting you do shouldn't alter a page's depth. For example, this would be okay:

myfarm/webapp1/testpage.aspx => app1.myfarm/webapp1/testpage.aspx

... but avoid doing something like this:

myfarm/webapp1/testpage.aspx => app1.myfarm/webapp1/newsite/testpage.aspx

These are fabricated examples, but I hope the point I'm trying to make is clear. In the first example, testpage.aspx is "2 levels" deep from the hostname -- and it stays that way on re-write/redirect. In the second example, it goes from 2 levels deep to 3 levels deep. Depth changes like this can lead to all sorts of insidious little problems during normal operations, as SharePoint depends on the path depth and ordering for some operations and determinations.

I hope this helps!

Related Topic