【问题标题】:Mod Rewrite rule to Zeus Server rule (Codeigniter)将规则重写为 Zeus 服务器规则 (Codeigniter)
【发布时间】:2010-09-25 05:00:14
【问题描述】:

我即将使用 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

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

【问题讨论】:

    标签: apache mod-rewrite codeigniter rewrite zeus


    【解决方案1】:

    想通了-以下对我来说很好用:

    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}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-16
      相关资源
      最近更新 更多