Iis7 URL 重写整个目录,剥离index.aspx

发布于 2025-01-06 03:05:06 字数 1142 浏览 2 评论 0 原文

iis7 Windows 2008服务器 iis重写模块 .net 4

非常简单的问题,我正在使用重写模块并发现它非常好,但我需要帮助设置一个我似乎无法正确的规则。

http://www.vinylsearcher.com/dance-music/downtempo-records/

标准: 对 dance-music 文件夹的任何请求都必须去掉末尾的 index.aspx,这样它就会像这样结束:

http://www.vinylsearcher.com/dance-music/downtempo-records/

不是

http://www.vinylsearcher.com/dance-music/downtempo-records/index .aspx

但也必须适用于:

http://www.vinylsearcher.com/dance-music/downtempo-records/mostexpense/index.aspx

需要重写为:

http://www.vinylsearcher.com/dance-music/downtempo-records/mostexpense/

我已经绕了一圈又一圈,所以希望得到一些帮助。

感谢您。

Iis7 windows 2008 server
Iis rewrite modual
.net 4

Very simple question, I am using the rewrite modual and find it pretty good, but I need help setting up a rule I just can't seem to get right.

http://www.vinylsearcher.com/dance-music/downtempo-records/

Criteria:
Any request to the dance-music folder must strip index.aspx off the end so it ends like:

http://www.vinylsearcher.com/dance-music/downtempo-records/

Not

http://www.vinylsearcher.com/dance-music/downtempo-records/index.aspx

But also must work for :

http://www.vinylsearcher.com/dance-music/downtempo-records/mostexpensive/index.aspx

Needs to rewrite to:

http://www.vinylsearcher.com/dance-music/downtempo-records/mostexpensive/

I have gone round and round in circles so would appreciate some help.

Thanks you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦在深巷 2025-01-13 03:05:06

将其添加到 /defaultDocument 部分下方的 web.config 文件中:

<rewrite>
    <rules>
      <rule name="Imported Rule 1" stopProcessing="true">
      <match url=".*" ignoreCase="false" />
      <conditions>
        <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.aspx" />
      </rule>
    </rules>
</rewrite>

add this to the web.config file underneath the /defaultDocument section:

<rewrite>
    <rules>
      <rule name="Imported Rule 1" stopProcessing="true">
      <match url=".*" ignoreCase="false" />
      <conditions>
        <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.aspx" />
      </rule>
    </rules>
</rewrite>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文