Iis 7 在IIS7中对友好URL使用URL重写时出现问题

Iis 7 在IIS7中对友好URL使用URL重写时出现问题,iis-7,url-rewriting,Iis 7,Url Rewriting,我正在尝试使用URL重写在IIS7服务器中制定一些重写规则。 例如,我有一个url mydomain.com/data.php?id=1,我想将其转换为mydomain.com/archive/1 目前我有: <rule name="Ugly to friendly" stopProcessing="true"> <match url="^data\.php$" /> <conditions> <add input="{REQ

我正在尝试使用URL重写在IIS7服务器中制定一些重写规则。 例如,我有一个url mydomain.com/data.php?id=1,我想将其转换为mydomain.com/archive/1

目前我有:

    <rule name="Ugly to friendly" stopProcessing="true">
  <match url="^data\.php$" />
  <conditions>
      <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
      <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" />
  </conditions>
  <action type="Redirect" url="archive/{C:2}" appendQueryString="false" /> 
</rule>

<rule name="Friendly to ugly" stopProcessing="true">
  <match url="archive/(.+)" />
  <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  </conditions>
  <action type="Rewrite" url="data.php?id={R:1}" />
</rule>

但它不起作用(读作“页面在没有该规则的情况下显示良好,但当添加规则时,不会显示css/IMG”)。 奇怪的是,firebug告诉我一切都很好(200好)(也许它也被搞糊涂了?)


关于

对不起,代码很好。我的页面(data.php)是错误的。与其让所有IMG/css都使用php文件中的相对路径,我应该使用根目录中的相对路径编写它们

我的意思是,我应该写“img src=“/folder1/fol”,而不是“img src=“..../test.jpg”

请注意路径边缘的“/”