使用 web.config 将 IIS 重定向到 PHP
我写了这个文件用于重定向,但我不明白为什么第六个重定向不起作用。所有其他的都可以工作。
我对 IIS 和 ASP 确实很陌生(并且打算保持这样:)),但需要对此进行一些澄清,以便我可以继续。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="r1">
<match url="contact.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/contact/"/>
</rule>
<rule name="r2">
<match url="send2friend.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/contact/"/>
</rule>
<rule name="r3">
<match url="admin/login.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/wp-admin/"/>
</rule>
<rule name="r4">
<match url="members-club/join_member.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/newsletter/"/>
</rule>
<rule name="r5">
<match url="articles/dynamic-web-archive.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/blog/articles-and-newsposts/"/>
</rule>
<rule name="r6">
<match url="articles/dynamic-web-articles.aspx?page_id=55&parent_id=0&pgnm=%D7%97%D7%92%D7%99%D7%9D"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/blog/%D7%93%D7%99%D7%90%D7%98%D7%94-%D7%91%D7%97%D7%92%D7%99%D7%9D/"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I've wrote this file for redirection and I don't understand why the sixth redirection does not work. all the other ones do work.
I'm really new to IIS and ASP (and intend to keep myself like this :) ) but need some clarification about this so I could move on.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="r1">
<match url="contact.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/contact/"/>
</rule>
<rule name="r2">
<match url="send2friend.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/contact/"/>
</rule>
<rule name="r3">
<match url="admin/login.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/wp-admin/"/>
</rule>
<rule name="r4">
<match url="members-club/join_member.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/newsletter/"/>
</rule>
<rule name="r5">
<match url="articles/dynamic-web-archive.aspx"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/blog/articles-and-newsposts/"/>
</rule>
<rule name="r6">
<match url="articles/dynamic-web-articles.aspx?page_id=55&parent_id=0&pgnm=%D7%97%D7%92%D7%99%D7%9D"/>
<action type="Redirect" redirectType="Permanent" url="http://www.doctornestor.co.il/blog/%D7%93%D7%99%D7%90%D7%98%D7%94-%D7%91%D7%97%D7%92%D7%99%D7%9D/"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的最后一条规则 (r6) 无效。 URL 模式不能包含查询字符串。查询字符串必须通过条件单独匹配。
这是正确的规则:
Your last rule (r6) is invalid. The URL pattern CANNOT include query string. Query String has to be matched separately, via conditions.
Here is correct rule: