Alternate Access Mappings helps to expose a SharePoint web application to different URLs in scenarios such as publishing, load balancing, reverse proxy, etc. Each web application can have up to five different URLs through alternate access mapping, with the “Default” zone as mandatory and other optional zones.
How to Configure Alternate Access Mapping in SharePoint Central Administration?
Follow these steps to set alternate access mapping in SharePoint:
- Go to the SharePoint 2016 Central Administration Site, Click on System Settings from Left navigation menu.
- From the “System setting” page, click on “Configure Alternate Access Mappings” link under in the “Farm Management” group.
- You will be presented with the Alternate Access Mappings page. Select your desired web application to get the AAM settings for the specific web application.
Here, The public URL is the address of the Web Application, where the traffic will be routed to. Internal URLs are what’s entered in the browser, and it’s either transformed/mapped into the Public URL.
To add an alternate access mapping, with the target web application selected, click on “Edit Public URL’s” link >> Enter the appropriate URL for the respective zone and hit Save to commit your changes.
You can also use PowerShell to manage Alternate Access Mappings in SharePoint.
Add alternate access mapping SharePoint using PowerShell:
To add an entry to SharePoint alternate access mapping using PowerShell, use cmdlet: New-SPAlternateURL. Here is an example:
New-SPAlternateURL -WebApplication "https://intranet.crescent.com" -URL "https://portal.crescent.com" -Zone Internet
Add a binding to the web application in IIS:
But wait, You are not yet done. This is a common miss in SharePoint. Although you add AAM entry, You must also add IIS binding for the web application for initial redirect to the IIS site.
You can now access the existing SharePoint web application “https://intranet.crescent.com” using the new URL “https://portal.crescent.com”.
PowerShell to remove alternate access mapping:
To remove an existing AAM entry, use the PowerShell cmdlet: Remove-SPAlternateURL. Here is an example:
Get-SPAlternateURL -WebApplication "https://intranet.crescent.com" -Zone "Internet" | Remove-SPAlternateURL
Get SharePoint alternate access mappings using PowerShell:
To read all alternate access mappings for a given web application, use this PowerShell script.
Get-SPAlternateURL -WebApplication "https://intranet.crescent.com" | Format-table -AutoSize
Similarly, to get the AAM settings for a specific zone, say Internet, use:
Get-SPAlternateURL -WebApplication "https://intranet.crescent.com" -Zone "Internet"