Solved

iis 7 url rewrite problem

Posted on 2010-08-26
6
1,019 Views
Last Modified: 2012-05-10
i am trying to change too change this url
book.asp?SC=ABC5027#offer&rmid=SurvivalGuideE4&rrid=237952859
to move the anchor tag to the end.... like:
book.asp?SC=ABC5027&rmid=SurvivalGuideE4&rrid=237952859#offer

the rule we're trying is seems to test ok, but doesnt work in practice

     <rule name="Responsys#">
<match url="(.*landing/.*)#(.*?)&amp;(.+)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="{R:1}&amp;{R:3}#{R:2}" appendQueryString="false" logRewrittenUrl="false" />
         </rule>

0
Comment
Question by:jimwarrenus
  • 3
  • 3
6 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33543083
The URL in the form

book.asp?SC=ABC5027#offer&rmid=SurvivalGuideE4&rrid=237952859

is not valid in that the rmid and rrid elements are just part of the # fragment.

e.g.

php -r "var_dump(parse_url('book.asp?SC=ABC5027#offer&rmid=SurvivalGuideE4&rrid=237952859'));"
array(3) {
  ["path"]=>
  string(8) "book.asp"
  ["query"]=>
  string(10) "SC=ABC5027"
  ["fragment"]=>
  string(41) "offer&rmid=SurvivalGuideE4&rrid=237952859"
}

What is generating it?

So, the part of the query that IIS will get to play with is ...

book.asp?SC=ABC5027

If you set the appendQueryString option, it will just append it again.

Also, you are requiring the URL to contain landing/

Something that the url you've supplied doesn't contain.

I'm using IIS7.

Below is a screen shot ...

What is generating the URL?

Is it an AJAX call and are you just appending the values without splitting out the #fragment?


TestPattern.png
0
 

Author Comment

by:jimwarrenus
ID: 33544283
you're right ... i left off the /landing
 
take a look at the attached screenshot....
landing/book/book.asp?SC=ABC5027#offer&rmid=SurvivalGuideE4&rrid=237952859
thanks, jim

ScreenShot237.jpg
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33544986
And now using ...



I don't think you need to escape &, so & and not &amp;
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:jimwarrenus
ID: 33553746
hmmm, when i remove the amp; i get this error
 
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
Config Source 13: <rule name="Responsys#"> 14: <match url="(.*landing/.*)#(.*?)&(.+)" /> 15: <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />  
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33554481
I'll take a look when I get back in the office on Tuesday. No IIS available from home.
0
 

Accepted Solution

by:
jimwarrenus earned 0 total points
ID: 33592335
it looks like the rewrite module stops at the # sign......   we gave up on that approach and used some redirect code instead...
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here are the symptoms: You start receiving calls from users that one of your legacy web apps isn't coming up, so you log into your IIS 5 server to check it out.  When you pull up the services, you notice that the WWW Publishing service isn't runn…
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now