【发布时间】:2021-03-26 12:13:50
【问题描述】:
首先谢谢大家,英语不是我的母语 但是这个问题对我来说很难
我需要
http://xxxx.show.bis.tw/event_register/index.php?id=image01
至
http://xxxx.show.bis.tw/event_register/image01
如果用户在地址栏输入http://xxxx.show.bis.tw/event_register/image01
该网站可以运行
我认为规则是
用户可以输入那些
http://xxxx.show.bis.tw/event_register/image01
http://xxxx.show.bis.tw/event_register/index.php?id=image01
1。
http://xxxx.show.bis.tw/event_register/index.php?id=image01
像这样重定向http://xxxx.show.bis.tw/event_register/image01 并转到 rule2
重写<action type="Rewrite" url="index.php?id={C:1}" />
2。
http://xxxx.show.bis.tw/event_register/image01
只是重写<action type="Rewrite" url="index.php?id={C:1}" />
我的代码是 如果文件和目录做重定向或重写网站会损坏(css/js/image)
我尝试将 rule>1 和 rule>2 写入一个规则,但它不起作用 不知道怎么解决
<rewrite>
<rules>
// 1
<rule name="025" stopProcessing="true">
<match url=".*" />
<conditions> // file and directory not Redirect|Rewrite
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="{C:0}" appendQueryString="false" />
</rule>
// 2
<rule name="026">
<match url="index\.php(.*)" />
<conditions>
<add input="{QUERY_STRING}" pattern="id=(.*)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
// 3
<rule name="027" enabled="true" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{URL}" pattern="/index.php?id=" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?id={R:1}" />
</rule>
</rules>
</rewrite>
谢谢大家非常感谢 我几乎两天睡不着就解决这个问题
【问题讨论】:
-
尝试使用failed request tracking获取详细的错误信息。
标签: url iis mod-rewrite