Monday, March 14, 2016

Urlrewrite and sharepoint 2013

I some trouble recently getting urlrewrite to play along with SP2013 and IIS 8.
HostNamedSiteCollection wasn’t doable for a lot of other reasons.
Scenario: Using urlrewrites to handle vanityurls for site collections in SP2007. When migrating to SP2013 these rules don’t work at all.

Symptoms: image

  • With outboundrules activated nothing works for webapplication. (Website cannot display the page) 
  • Always lands on top site collection, rewrite dont work.

Solution:
A combination of a few fixes

  • Install patch kb2749660 to fix outboundrules
  • Add registry key ("HKLM:\Software\Microsoft\InetStp\Rewrite\" (Dword) LogRewrittenUrlEnabled=0)
  • Deactivate Static Compression on IIS-site
  • Add rewrite rule like {HTTP_HOST} matches pattern ^www.labb13.nu(.*)

image

References:
https://support.microsoft.com/en-us/kb/2749660 - Response is corrupted when you configure an outgoing rule in URL Rewrite Module 2.0 for IIS 7.0 or IIS 7.5
http://ruslany.net/2010/05/storing-url-rewrite-mappings-in-a-separate-file/
https://blogs.msdn.microsoft.com/danielvl/2010/01/07/registry-values-for-iis-url-rewrite/
http://stackoverflow.com/questions/14607390/iis-urlrewrite-is-not-working-for-iis-8
http://social.technet.microsoft.com/wiki/contents/articles/23074.sharepoint-2013-url-rewrite.aspx
http://blogs.technet.com/b/mspfe/archive/2013/11/27/how-to-create-a-url-alias-using-iis-url-rewrite.aspx – example (without sharepoint)
http://johnliu.net/blog/2010/7/23/sharepoint-2010-with-iis-url-rewrite-20.html
https://www.iis.net/learn/extensions/url-rewrite-module/creating-outbound-rules-for-url-rewrite-module
https://social.technet.microsoft.com/Forums/en-US/8d076df4-d93c-47be-80cc-f22dddc1c4c8/how-to-implement-url-rewriting-for-sharepoint?forum=sharepointdevelopmentprevious – similar problem. http://blog.mastykarz.nl/friendly-urls-sharepoint-site-4-steps-iis7-url-rewrite-module/ - rewrite with sharepoint 2013
http://blogs.msdn.com/b/chiranth/archive/2014/06/13/url-rewrite-part-3-outbound-rules-amp-rewrite-maps.aspx - why use outbound rules?
https://support.microsoft.com/sv-se/kb/2818415 - supported assymentrical solutions