简体   繁体   English

IIS 7 +网址重写:文件未显示在子域中

[英]IIS 7 + Url Rewrite: files don't show up on subdomain

I use URL Rewrite on IIS 7.5 and I created a rule to rewrite subdomains like this "test.localwebsite.com" -> "test.localwebsite.com/test" and then I do additional rewrite with this URL and content on the page loads just fine, but files won't load, they have such URL "test.localwebsite.com/design/style.css". 我在IIS 7.5上使用URL重写,并创建了规则来重写子域,例如“ test.localwebsite.com”->“ test.localwebsite.com/test”,然后使用此URL和页面加载的内容进行其他重写很好,但是文件无法加载,它们的网址为“ test.localwebsite.com/design/style.css”。 How to make them load? 如何使它们加载?

<rewrite>
  <rules>
    <rule name="Subdomain Rewrite" enabled="true" stopProcessing="true">
      <match url="(.*)" ignoreCase="true" />
      <conditions>
           <add input="{HTTP_HOST}" pattern="(?:www\.)?(?:([^.]+)\.)?localwebsite\.com" />
      </conditions>
      <action type="Rewrite" url="{C:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>

you must ignore rewrite fro css, axd files and images that also will make errors in empedded resources. 您必须忽略对css,axd文件和图像的重写,这些重写也会使嵌入式资源出错。

.*?$(?<!\.css)

OR 要么

.*?$(?<!\.css|.axd)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM