ISAPI Rewrite for SharePoint?

Common questions to Helicon Tech
User avatar
Posts: 6
Joined: 14 Aug 2012, 18:58

ISAPI Rewrite for SharePoint?

14 Aug 2012, 19:35

I would like to start a topic for all of us working to remove the infamous /Pages/ directory and ASPX extensions from our Internet facing SharePoint websites.

During my research, I have found the following post in the old forum... there, Anton offered great suggestions, one being "I advise you to use ISAPI_Rewrite v2 because it works on earlier stage than ISAPI_Rewrite 3 and before the Sharepoint filter. ". This is important to me because I am having issues with the SharePoint pipeline and this suggestion may address it. My only concern is with the age of this product and also the age of the post itself - 2009.

http://www.helicontech.com/forum/12773-ISAPI_Rewrite_30_for_sharepoint.html

I am wondering if any new information has come to light about this issue. And if not, maybe other products have come to address it in a better way. LinkFreeze? Helicon Ape?

The way that I found to get around the poster's question, was to setup an Authoring Farm and a Production Farm. This allows me to keep the Pages in authoring and have clean URLs in Production. This fixes the Authoring issue since no clean up is necessary on the Authoring Farm so its AJAX Interfaces do not need to be "Re-Written" here. More details on how to setup SP 2010 like this here...http://technet.microsoft.com/en-us/library/cc262004

In doing this, however, you may stumble upon the issue that I am having... some of your banners and menu links, may click to the old (and friendly) URLs. Your Authoring Farm will not know what do to with it and you will need to redirect those. In trying to address the issue and compose a nice redirection to address the issue, I ended up with an infinite loop condition. Here is my config:

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.89

RewriteEngine Off
# AllowOverride none
RewriteCompatibility2 On
RepeatLimit 5
RewriteBase

<VirtualHost Production URL Removed> THIS WORKS REALLY GOOD AND WILL SOLVE MOST SHAREPOINT ISSUES WITH UGLY URLS!
# Production Config

RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 5
RewriteBase
# AllowOverride all

# ####### SP 2010 ##########

# Skip Folders
RewriteCond %{REQUEST_URI} ^/_.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/pages.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/menu.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/lecms.*$ [NC]
RewriteRule .* - [L]
#RewriteRule ^(.*)$ $1 [NC,L]

# Redirect to Pretty URLs
RewriteCond %{REQUEST_URI} ^.*/pages.*$ [NC]
RewriteRule ^(.*?/)pages/([^/]+)\.[^/]+$ $1$2.htm [NC,R=301]

# Rewrite SP URL
RewriteCond %{REQUEST_URI} !^/_.*$
RewriteCond %{REQUEST_URI} !^/pages.*$
RewriteCond %{REQUEST_URI} !^/lecms.*$
RewriteCond %{REQUEST_URI} !^/menu.*$
RewriteRule ^(.*?)([^/]+)\.[^/]+$ $1Pages/$2.aspx [NC,L]

</VirtualHost>

<VirtualHost Authoring URL Removed>
# Dev and Stage Config

RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 5
RewriteBase
# AllowOverride all

# ####### SP 2010 ##########

# Skip Folders
RewriteCond %{REQUEST_URI} ^/_.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/pages.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/menu.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/lecms.*$ [NC]
RewriteRule .* - [L]
#RewriteRule ^(.*)$ $1 [NC,L]

# Rewrite SP URL
RewriteCond %{REQUEST_URI} !^/pages.*$
RewriteRule ^(.*?)([^/]+)\.[^/]+$ $1pages/$2.aspx [NC,L,R=301] THIS CAUSES INFINITE LOOP!!!

</VirtualHost>


Thank you in advance for your help!

PS: Please let me know if there are better ways to accomplish what I have done here. I realize some of my rewrites can be optimized...
PSS: What syntax is the LinkFreeze config in? From what I read, this can be a good solution. Outbound/Response ReWrite will be handy for the Production Farm.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: ISAPI Rewrite for SharePoint?

15 Aug 2012, 03:07

Hello,

Thanks for giving such thorough explanation.
But I'd like to inquire some more info:
- what version of IIS you are working with?
- regarding the looping rule: what URLs should be caught by this rule and how they should look after rewriting (give some specific examples and I'll try to improve the rule)

User avatar
Posts: 6
Joined: 14 Aug 2012, 18:58

Re: ISAPI Rewrite for SharePoint?

15 Aug 2012, 10:56

Sure thing...

Anton wrote:- what version of IIS you are working with?

Internet Information Services (IIS) 7.5 on Windows Server® 2008 R2

Anton wrote:- regarding the looping rule: what URLs should be caught by this rule and how they should look after rewriting (give some specific examples and I'll try to improve the rule)

# Pretty/Friendly URLs should be caught by this rule - These do not have the Pages folder or terminate in .aspx
http://spdev.abc.org/membership/benefits.htm

# Here is how they should look after rewriting
http://spdev.abc.org/membership/pages/benefits.aspx

# Here is what is happening
http://spdev.abc.org/membership/pages/p ... efits.aspx


Thank you again!
Last edited by CelloJ on 15 Aug 2012, 12:40, edited 1 time in total.

User avatar
Posts: 6
Joined: 14 Aug 2012, 18:58

Re: ISAPI Rewrite for SharePoint?

15 Aug 2012, 12:09

Starting a new Post to keep things organized... here is a sub topic I need input with:

Please share with me what syntax the LinkFreeze config is in. Is it similar to ISAPI_REWRITE or more like APE? Would it be a better product for me to use? I am assuming it lodged pretty high on the IIS request pipeline... on the flip side, I fear it is not going to be as customizable as ISAPI_REWRITE is.

Furthermore, having Outbound/Response ReWrite ability would be a great thing to have to address the HTML links that are stored incorrectly within SharePoint. In the Production Farm, all links must go out like this: http://spdev.abc.org/membership/benefits.htm and not like this http://spdev.abc.org/membership/pages/benefits.aspx. But the latter is what is stored in the SharePoint database.

Think of this as the opposite of what is needed in Authoring. But I can address this in other ways if LinkFreeze is not the best solution for this.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: ISAPI Rewrite for SharePoint?

16 Aug 2012, 05:56

Hello,

first, let's try to fix the looping rule in ISAPI_Rewrite:

RewriteCond %{REQUEST_URI} !^.*/pages/.*$
RewriteRule ^(.*?)([^/.]+)\.[^/.]+$ $1pages/$2.aspx [NC,L,R=301]

As for LinkFreeze:
"Is it similar to ISAPI_REWRITE or more like APE?"
- it's not similar to any of them. ISAPI_Rewrite and Ape are similar between themselves in that they both do URL rewriting, but Ape has another 30+ modules.

"I fear it is not going to be as customizable as ISAPI_REWRITE is."
this is true. You won't be able to change http://spdev.abc.org/membership/benefits.htm into http://spdev.abc.org/membership/pages/benefits.aspx in LinkFreeze.

Please see this article for more info: http://www.helicontech.com/articles/isa ... is-better/

User avatar
Posts: 6
Joined: 14 Aug 2012, 18:58

Re: ISAPI Rewrite for SharePoint?

27 Aug 2012, 14:35

Thank you so much! This did address the issue.

Here is a quick follow up: Now, I need to find folders and redirect them to [folder]/index.htm

Like this:

Test Strings:
http://spdev.abc.org/membership
http://spdev.abc.org/membership/

Result:
http://spdev.abc.org/membership/index.htm

Thank you in advance!

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: ISAPI Rewrite for SharePoint?

28 Aug 2012, 04:32

Hello,

Please try the following rule for that:

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^([^./]+?)/?$ $1/index.htm [R=301,L]

User avatar
Posts: 6
Joined: 14 Aug 2012, 18:58

Re: ISAPI Rewrite for SharePoint?

28 Aug 2012, 13:07

Dear Anton, this works good, thank you. But unfortunately, it does not address deeper folders like this:

http://spdev.abc.org/membership/sub
http://spdev.abc.org/membership/sub/

Thank you in advance!

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: ISAPI Rewrite for SharePoint?

29 Aug 2012, 04:24

Sorry, I didn't know you need it for subfolders. Please fix it like this:

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+?)/?$ $1/index.htm [R=301,L]

User avatar
Posts: 6
Joined: 14 Aug 2012, 18:58

Re: ISAPI Rewrite for SharePoint?

05 Sep 2012, 19:21

Thank you Anton. Your help is indispensable.

Posts: 19
Joined: 28 Sep 2012, 01:54

Re: ISAPI Rewrite for SharePoint?

01 Oct 2012, 01:27

This is a good thread for anyone who is just starting. It is good for you to share it. Image

User avatar
Posts: 1
Joined: 14 Sep 2017, 07:29

make an essay for me

14 Sep 2017, 07:44

I am really grateful to the owner of this web page who has shared this wonderful post make an essay for me .

User avatar
Posts: 1
Joined: 14 Sep 2017, 07:47

Cheap Essay Writing Service

15 Sep 2017, 04:55

If you want to get a good deal from this piece of writing then you have to apply these strategies to your won website. Cheap Essay Writing Service

User avatar
Posts: 3
Joined: 13 Sep 2017, 12:38

Re: ISAPI Rewrite for SharePoint?

18 Oct 2017, 14:48

Thanks a lot for posting that info

Return to Common Questions

Who is online

Users browsing this forum: No registered users and 5 guests