1

I need http://example.com/photogallery to be redirected to http://www.example.com/photogallery (adding the "www"). For some reason it always redirects to http://www.example.com/Pages/default.aspx. I have the following rewrite rule in my web.config:

<rule name="Vanity URL" stopProcessing="true">
  <match url=".*" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="example.com" />
    <add input="{URL}" pattern="^photogallery$" />
  </conditions>
  <action type="Redirect" url="http://www.example.com/photogallery" appendQueryString="false" redirectType="Found" />
</rule>

I've also tried putting the URL match outside of the conditions:

<rule name="Vanity URL" stopProcessing="true">
  <match url="^photogallery$" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="example.com" />
  </conditions>
  <action type="Redirect" url="http://www.example.com/photogallery" appendQueryString="false" redirectType="Found" />
</rule>

I've also tried a million permutations of regexes, but I feel like there is some default Sharepoint routing to the main default.aspx page that is overriding all of my efforts. Can anyone help?

0

If you have the publishing features enabled in your site collection, you can specify the welcome page (ie the default page that is loaded when someone hits example.com or www.example.com). If you don't have the publishing features enabled, you can set your default home page in Sharepoint Designer.

0

You might need to properly configure the Alternate Access Mappings so that both "www" and "no-www" are available as endpoints to your Web Application.

This post might help understanding how that works: http://blogs.msdn.com/b/sharepoint_strategery/archive/2013/05/27/alternate-access-mappings-explained.aspx

Also make sure that the bindings are created in IIS. Here's an explanation on this: http://blogs.technet.com/b/chrad/archive/2010/01/24/understanding-iis-bindings-websites-virtual-directories-and-lastly-application-pools.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.