SharePoint 2010 - configuring URLs for Internet use (AAR, URL rewriting, alternate access mappings)
Introduction
The Alternate Access Mappings (AAM) of SharePoint allows a website to function correctly under different "inbound" domain names. This feature can also include reverse proxies and load balancing scenarios.
Assuming that you have two domain names: "fourthcoffee.com" and "contoso.com" - how can you arrange for SharePoint to not just accept and respond to both domain names - but change any (incorrectly) specified domain names that people have accidentally used internally?
An example would be the following:
<a href="https://www.fourthcoffee.com/landingpage.aspx>link to the landing page</a>
while this link works well on the fourthcoffee.com website - the same link will fail if the page is used on Contoso.com. In general this problem doesn't arise, as virtually all links to content within SharePoint should be "relative links" that don't include a domain name. An example is:
Relative link:
<a href="https://blogs.technet.com/landingpage.aspx>link to the landing page</a>
How can this problem be solved? As the link is within the HTML itself - then the HTML must be adjusted to translate https://www.fourthcoffee.com into https://www.contoso.com . This is where ourbound "rewriting" of the web page is useful, and it is often used in conjunction with AAR.
For details on AAR - please see https://technet.microsoft.com/en-us/sharepoint/Video/ff679917, however I'll include a brief undown on the overall process here:
Assuming that your external domain name is www.sharepointinternet.com :
Create a binding for the Site in IIS to www.sharepointinternet.com
Edit the site bindings
|
|
Add a new site binding for "sharepointinternet.com" |
Create the alternate access mapping in SharePoint 2010
Simply creating the binding in IIS Manager doesn't create the proper binding to Sharepoint - in addition you also need to create the Alternate Access Mapping for the binding itself.
Add the reverse rewriting rules (in the HTML)
If the URLs within the HTML refer to the incorrect domain name - these will need to be re-written using the IIS URL Rewriting Module 2.0. In order to rewrite the HTML returned from IIS - configure the rewrite rule as follows:
Note that you may need to download and install the following:
- The URL Rewrite module - https://www.iis.net/download/URLRewrite
- The Application Request Routing module - https://www.iis.net/download/ApplicationRequestRouting
Additional details on the framework (and ASP.NET routing) are here:
For the site
|
|
Add a blank rule | |
Add a 'precondition' to only process HTML. A side effect if this is not done is that the URL Rewriter module will error - and send back "500 Server error" messages for non-HTML items such as Javascript. Sharepoint editing and menus will not work.
From "Precondition" - choose "ResponseIsHtml1" - or create a new rule where the Content-type is "text/html".
The rule becomes: {RESPONSE_CONTENT_TYPE} <-- Condition input matches ^text/html |
|
The values should be similar to the following:
Details on the test pattern and captures are available here:
Actions
Note well - This rewrites the URLs within outbound HTML only. The inbound URLs (domain names and URLs hitting the SharePoint server aren't affected - these should be catered for using hthe the bindings and alternate access mappings above). |
|
Choose where URLs and domain names should be matched (generally within A and IMG tags at least) |