Solved

iis 7 url rewrite problem

Posted on 2010-08-26
6
1,020 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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