我有一个网址,看起来像这样:
I have a url that looks like this:
www.mywebsite/page.aspx?code=1.a我想通过IIS重定向此URL:
I want to redirect this URL via IIS to:
www.mywebsite/page.aspx?code=1.b我想通过IIS,而不是code范围内做到这一点。
I would like to do this through IIS and not within the code.
我有一个看起来像其他各种网站网址:
I have various other website urls that look like:
www.mywebsite/page.aspx?code=2 www.mywebsite/page.aspx?code=3.a www.mywebsite/page.aspx?code=6.c我不希望这些受到影响。
I don't want these to be affected.
感谢。
推荐答案这是简单的方法在IIS 7.5中做,这是到 URL重写微软扩展安装到IIS。
An easy way to do this in IIS 7.5 is to install the URL Rewrite extension from Microsoft into IIS.
www.iis/downloads/microsoft/url-rewrite
一旦你安装它,你可以添加规则,从?code = 1.A 重定向到?code = 1.B 。在IIS中,你会看到一个名为 URL重写在 IIS 为您的网站的标题新的条目。您可以使用编辑器那里创建新规则。一旦规则被创建,它会被写入到的web.config 文件。
Once you have it installed, you can just add a rule to redirect from ?code=1.a to ?code=1.b. In IIS, you'll see a new entry called URL Rewrite under the IIS heading for your website. You can use the editor there to create a new rule. Once the rule is created, it will be written into your web.config file.
在的web.config 文件,规则应该是这个样子:
In the web.config file, the rule should look something like this:
<system.webServer> ... <rewrite> <rules> <rule name="Code=1.a redirect" patternSyntax="ExactMatch" stopProcessing="true"> <match url="page.aspx" /> <action type="Redirect" url="page.aspx?code=1.b" appendQueryString="false" redirectType="Permanent" /> <conditions> <add input="{QUERY_STRING}" pattern="code=1.a" /> </conditions> </rule> </rules> </rewrite> ... </system.webServer>更多推荐
如何网址重定向只有在IIS具体参数
发布评论