Mobile app version of vmapp.org
Login or Join
Hamm4606531

: 301 redirecting urls with special characters using web.config I am trying to redirect some old urls containing some special characters. When I place the url on the web.config automatically it

@Hamm4606531

Posted in: #301Redirect #Redirects #Windows

I am trying to redirect some old urls containing some special characters. When I place the url on the web.config automatically it gives me a 500 internal server error.

So, how do I translate the special character "&" to get it working.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamm4606531

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

The HTTP status code 500 "internal server error" is shown because the URL's you used are not properly escaped.

A quote from StackOverflow:


When adding a query string in the action of a rewrite rule, you've got to escape all the "?" and "&" characters in the URL.


? = ?
& = &


For example the following won't work:

<action type="Redirect" url="/long_url.aspx?key1=value1&key2=value2" />


For example the following will work:

<action type="Redirect" url="/long_url.aspx&#63;key1=value1&amp;key2=value2" />

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme