3

我即将与 Codeigniter 支持的网站一起上线。我想从 url 中删除 index.php ,而不是这样:

http://www.mysite.com/index.php/controller

我得到这样的东西:

http://www.mysite.com/controller

到目前为止,非常简单。在过去,我使用了 Codeigniter 文档提供的 mod-rewrite 规则:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

这就像一个魅力。但是,对于这个站点,我不得不使用 Zeus Web 服务器而不是 Apache,而且我对它一点也不熟悉。Zeus 有自己的重写规则,例如:

RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^[^/]*\.html$ index.php

会变成这样:

match URL into $ with ^/[^/]*\.html$
if matched then set URL = /index.php

谁能帮我重写宙斯的第一条规则?非常感谢您的任何帮助!

4

1 回答 1

3

想通了-以下对我很有效:

map path into SCRATCH:DOCROOT from /

set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}

look for file at %{SCRATCH:DOCROOT}%{SCRATCH:REQUEST_URI}
if not exists then look for dir at %{SCRATCH:REQUEST_URI}%{SCRATCH:REQUEST_URI}
if not exists then set URL = /index.php%{SCRATCH:REQUEST_URI}
于 2008-12-04T12:05:30.213 回答