0

我正在尝试在我的网络域上使用 isapi 重写工具来编写一些基本规则,但我有点困惑。

我的基本网址是http://forevr-dev.co.uk/musicexplained/index.cfm,网站上的每个页面都来自这个基本网址。例如http://forevr-dev.co.uk/musicexplained/index.cfm/artist/blondie将是 blondie 的艺术家页面。

我正在寻找的是一个重写规则,它将从 url 中删除 index.cfm,而不是留下http://forevr-dev.co.uk/musicexplained/artist/blondie

我已将 httpd.ini 文件放在我的 musicexplained 文件夹中,位于我的 forevr-dev.co.uk 域的根目录下,并且我正在使用以下代码,该代码来自 Coldbox Coldfusion 框架应用程序示例。

RewriteEngine On
RepeatLimit 0

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L]

但是,当我现在转到新的漂亮 url 时,我收到一条错误消息,指出找不到页面,以及 404 消息。

有任何想法吗?

谢谢

4

1 回答 1

0

问题是您正在谈论 httpd.ini 文件(在 ISAPI_Rewrite v2 中使用),上面的语法适用于 v3。所以你的版本很重要......

对于 v2,请尝试:

[ISAPI_Rewrite]
RewriteRule ^/(?!index\.cfm.*)(.*)$ index.cfm/$1 [I,L]

对于 v3,请尝试:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? index.cfm/%{REQUEST_URI} [QSA,L]
于 2010-06-08T10:16:28.417 回答