【问题标题】:Isapi Rewrite : Remove filename from URLIsapi 重写:从 URL 中删除文件名
【发布时间】:2010-04-19 19:43:27
【问题描述】:

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

我的基本网址是http://forevr-dev.co.uk/musicexplained/index.cfm,网站上的每个页面都来自这个基本网址。例如http://forevr-dev.co.uk/musicexplained/index.cfm/artist/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 消息。

有什么想法吗?

谢谢

【问题讨论】:

  • 碰到这个话题...我也有同样的问题。

标签: mod-rewrite isapi-rewrite


【解决方案1】:

问题是您在谈论 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]

【讨论】:

    猜你喜欢
    • 2017-07-02
    • 2011-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-06
    • 2023-04-03
    • 1970-01-01
    相关资源
    最近更新 更多