I have following rewrite rule in web.config:
<rewrite>
<rules>
<rule name="Search" stopProcessing="true">
<match url="^search/(.+)$" />
<action type="Redirect" url="?q={R:1}" />
</rule>
</rules>
</rewrite>
It works fine both on IIS Express 8.0 and IIS 7.5 on Azure Websites for urls like /search/test
(only ascii characters) - redirects to /?q=test
.
But for urls with unicode characters (/search/тест
or /search/%D1%82%D0%B5%D1%81%D1%82
) on IIS 7.5 on Azure Websites redirects to /?q=теÑÑ‚
(or /?q=%C3%91%E2%80%9A%C3%90%C2%B5%C3%91%C2%81%C3%91%E2%80%9A
) instead of /?q=%D1%82%D0%B5%D1%81%D1%82
. It works correctly on IIS Express 8.0.
IIS Rewrite Module ProblemUninstall the Rewrite Module from Windows Features. Go to the Web Platform Installer. Pick Url Rewrite from Products | Server section and install. Restart IIS.
About the URL Rewrite module The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create powerful customized rules to map request URLs to friendly URLs that are easier for users to remember and easier for search engines to find.
You should use the internal {UrlEncode:{}}
function to properly encode the characters that are invalid in the URL (e.g. UTF-8 characters). So replace the URL part with: url="?q={UrlEncode:{R:1}}"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With