Reputation: 914
I am using this answer https://stackoverflow.com/a/13861795/848513 which works great for static files, which no longer exist on my site, to forwards to new file locations.
But I also have some dynamic URL's that need to be forwarded to new locations, and the following code doesn't seem to work:
Works:
<rule name="SpecificRedirect50" stopProcessing="true">
<match url="aboutus.php" /> <!-- static URL -->
<action type="Redirect" url="/about-us" redirectType="Permanent" />
</rule>
Does not work:
<rule name="SpecificRedirect1" stopProcessing="true">
<match url="topic.php?id=39" /> <!-- dynamic URL-->
<action type="Redirect" url="/folder/?id=520" redirectType="Permanent" />
</rule>
The error i get when trying to go to www.site.com/topic.php?id=39 is a 404 Not Found error - ie, it isn't being filtered by the rewrite script.
What should the format be?
Thanks
Upvotes: 0
Views: 207
Reputation: 914
OK, found answer - this format works:
<rule name="SpecificRedirect1111" stopProcessing="true">
<match url="^topic\.php$" />
<conditions>
<add input="{QUERY_STRING}" pattern="^id=39$" />
</conditions>
<action type="Redirect" url="/folder/?id=520" appendQueryString="false" redirectType="Permanent" />
</rule>
Upvotes: 1