Solved

url rewrite not working

Posted on 2014-07-30
2
290 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
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…

705 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

19 Experts available now in Live!

Get 1:1 Help Now