I have a website that has language options of which one is turkish (tr).
The problem is that I deleted the language in the website (end user can no longer check the site in turkish) BUT the links can still be consulted via Google.
An example link looks like: http://example.com/page2.aspx?lang=tr .
What I want to do to solve this, is to redirect all requests to ?lang=tr
to my homepage ( http://example.com ).
Is this achievable via URL rewriting? How would I do this?
I have checked it in rewrite module but didn't came further than this:
<rewrite>
<rules>
<rule name="Test" patternSyntax="Wildcard">
<match url="?lang=tr" ignoreCase="true" />
<action type="Redirect" url="{R:1}?lang=en" appendQueryString="false" />
<conditions logicalGrouping="MatchAny">
</conditions>
</rule>
</rules>
</rewrite>
试试这个<rewrite> <rules> <rule name="Test" stopProcessing="true"> <match url=".*" /> <action type="Redirect" url="/" appendQueryString="false" redirectType="Permanent" /> <conditions> <add input="{QUERY_STRING}" pattern="lang=tr" /> </conditions> </rule> </rules> </rewrite>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.