Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...

AspDotNetStorefront
DotFeed

Web.config Redirect rule with query string

Hello Guys,
Can anyone tell me the best way to create a redirect with a query string (Question mark) in the forward to address

Here's my code

<rule name="redirect_rule1" stopProcessing="true">
<match url="on-demand-candidates" />
<action type="Redirect" url="something.com?cg=cn&l=en_US" />
</rule>

When I redirect to that address I get a 500 internal server error.

If I remove the ? It will attempt to redirect but I need the ? mark to be in the url.

Please advise.

Thanks, Dan

asked Feb 26, 2014 in General by dk4210 (110 points)

I don't think the query string should matter. I'd try something like this if its a re-direct of all pages

 

<configuration>
 <location>
    <system.webServer>
      <httpRedirect enabled="true" destination="http://www.mywebsite.com/?cg=cn&l=en_US" httpResponseStatus="Permanent" />
    </system.webServer>
  </location>
</configuration>
Are you passing the query string through from the original request or appending a new one at the time of the redirect?

If you're passing it through, I believe that the UrlRewrite module for IIS7 has a UI checkbox for appending the query string. Otherwise, I'm not sure, but I'm kind of curious as to why you'd be doing a wholesale query string append like that.

1 Answer

0 votes

Hmm, Dan try something.com/?cg=cn... instead of  something.com?cb=cn... I believe it's missing the / page directive.

Also, what is the actual page being redirected from (the from URL). I'm guessing default.aspx or is this from another platform? If another platform URL, I would recommend our 301 Redirect addon:  www.ecommercecartmods.com/p-36-301-url-redirect-for-aspdotnetstorefront.aspx

answered Mar 24, 2014 by jsimacek (6,825 points)
...