Solved

url rewrite not working

Posted on 2014-07-30
2
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A safe way to clean winsxs folder from your windows server 2008 R2 editions
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
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…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

737 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