Solved

url rewrite not working

Posted on 2014-07-30
2
293 Views
Last Modified: 2014-08-08
Any idea why this rewrite it not working
 <rule name="app" stopProcessing="true">
                    <match url="^app$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="safety-app/?e=poster" />
                </rule>

Open in new window


if you go to http://www.kars4kids.org/app
the query parameter doesn't come along.

Why doesn't this work?

If you go into the folder itself.
http://www.kars4kids.org/app/ 

I don't want any query parameters here. this one works.
if someone gets into the folder itself this is the rule

 <location path="index.asp">
        <system.webServer>
            <httpRedirect enabled="true" destination="http://www.kars4kids.org/safety-app/" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>

Open in new window


in the safety app folder itself, i have a redirect only for the index page
        <rewrite>
            <rules>
                <rule name="safety index" stopProcessing="true">
                    <match url="index.asp" />
                    <action type="Redirect" url="http://www.kars4kids.org/safety-app/$S$Q" />
                </rule>
            </rules>
        </rewrite>

Open in new window

0
Comment
Question by:rivkamak
  • 2
2 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 40231273
I am better at Regular Expressions than using them for URL rewriting so that is what I look at first.  Try removing the $ character in

<match url="^app$" />

so your new line is

<match url="^app" />

If that doesn't work please clarify what you are getting and what the rewritten result should look like.  The action in that first block of code hard codes the query string so I am not sure how the original URL matters.  Please clarify that also, if the suggestion above doesn't fix your problem.

bol
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 40231285
One other thing, the server should work with

<action type="Rewrite" url="safety-app/" appendQueryString="True"/>

Notice the new attribute.  If you used the GUI to set up the rule and action then there is a checkbox for "Append Query String" that would also set it to true.

Also notice I removed the query string in your action.  I believe you will have an issue if you provide a query string in the URL value AND have appendQueryString set to True.

bol
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RDS2012 vs RDS2008 4 40
Need to disable SSL Cipher 7 73
server core and windows updates 3 40
WMI Setup on Server 2012 and 2008 GPO 1 15
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

832 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