Forum Discussion

Bob_10976's avatar
Bob_10976
Icon for Nimbostratus rankNimbostratus
May 12, 2008

iRule re-write to replace ISAPI re-write

Hello all...

 

 

We are currently using ISAPI re-write in our portal to re-write uri's to the appropriate location. With the help of this forum I came up with the following, which works fine for /Portal/Category/

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] starts_with "/Portal/Category/" } {

 

HTTP::uri "/g2p/KII.G2P.Portal.Web.Pages/Category.aspx?id=[substr [HTTP::uri] 17 "\/"] "

 

}

 

}

 

 

But my issue is that I have a hundreds of entries in my ISAPI file and not all of them are /portal/category/ some do have the /portal/"somthing differnet", some have a different somthing/something. Obviously I don’t want to create hundreds of iRules or an iRule that has hundreds of “if then else” statements. Does anyone have any other suggestion or thoughts.

 

 

Below is a small example of some of the rewrites in my ISAPI file:

 

 

RewriteCond Host: test.mysite.com

 

RewriteRule /Portal/Search\.aspx(.*) /g2p/file.G2P.Portal.Web.Pages.Google/Search.aspx$1 [I]

 

 

RewriteCond Host: test.mysite.com

 

RewriteRule /Portal/SearchProxy\.aspx(.*) /g2p/file.G2P.Portal.Web.Pages.Google/SearchProxy.aspx$1 [I]

 

 

RewriteCond Host: test.mysite.com

 

RewriteRule /Portal/etc/(.*) /g2p/file.G2P.Portal.Web.Pages.Google/etc/$1 [I]

 

 

RewriteCond Host: test.mysite.com

 

RewriteRule /Portal/ExternalLink\.aspx(.*) /g2p/KII.G2P.Portal.Web.Pages/ExternalLink.aspx$1 [I]

 

 

RewriteCond Host: www\.test\.mayor\.state\.com

 

RewriteHeader Host: .* mayor\.state\.com

 

 

RewriteCond Host: test\.mayor\.state\.com

 

RewriteHeader Host: .* mayor\.state\.com

 

 

RewriteCond Host: cms\.test\.state\.mayor\.com

 

RewriteHeader Host: .* mayor\.state\.com

 

 

RewriteCond Host: test\.agency\.state\.com

 

RewriteHeader Host: .* agency\.state\.com

 

 

RewriteCond Host: www\.test\.agency\.state\.com

 

RewriteHeader Host: .* agency\.state\.com

 

 

RewriteCond Host: test\.cms\.agency\.state\.com

 

RewriteHeader Host: .* agency\.state\.com

 

 

RewriteCond Host: test\.another_agency\.state\.com

 

RewriteHeader Host: .* commerce\.state\.com

 

 

RewriteCond Host: www\.test\.another_agency \.state\.com

 

RewriteHeader Host: .* another_agency\.state\.com

 

 

RewriteCond Host: cms\.test\.another_agency \.state\.com

 

RewriteHeader Host: .* another_agency\.state\.com

 

 

 

Thanks in advance…

 

 

Bob