gpt4 book ai didi

iis-7 - 使用 web 配置从 url 中删除 index.cfm

转载 作者:行者123 更新时间:2023-12-04 16:10:23 25 4
gpt4 key购买 nike

快速问题 -

目前我的网址是这样的:index.cfm/camp/another-test
我希望它们看起来像这样:camp/another-test
我可以用我的 .htaccess 在 apache 上做得很好,但我需要能够用 web.config 在 iis7 上做到这一点。到目前为止,这是我的重写:

<rewrite>
<rules>
<rule name="Remove index.cfm" enabled="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/(assets|files|miscellaneous|robots.txt|favicon.ico|sitemap.xml|index.cfm)($|/.*$)" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}" />
</rule>
</rules>
</rewrite>

谢谢您的帮助!

最佳答案

我相信 CFWheels 要求您通过 rewrite.cfm 而不是 index.cfm 路由重写请求。

请参阅 Chris Peters 的评论 on this question

如果调整:

<rewrite>
<rules>
<rule name="Remove index.cfm" enabled="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/(assets|files|miscellaneous|robots.txt|favicon.ico|sitemap.xml|index.cfm)($|/.*$)" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}" />
</rule>
</rules>
</rewrite>

到:
<rewrite>
<rules>
<rule name="ColdFusion on Wheels URL Rewriting" enabled="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" matchType="Pattern" ignoreCase="true" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|CFFileServlet|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$)" />
</conditions>
<action type="Rewrite" url="/rewrite.cfm/{R:1}" />
</rule>
</rules>
</rewrite>

它应该可以解决您的问题,前提是您有:
<cfset set(URLRewriting = "On")>

在/config/settings.cfm

关于iis-7 - 使用 web 配置从 url 中删除 index.cfm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20227106/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com