代码之家  ›  专栏  ›  技术社区  ›  John McCollum

mod rewrite rule to zeus server rule(代码点火器)

  •  3
  • John McCollum  · 技术社区  · 16 年前

    我将要去一个代码点火器供电的网站。我想从url中删除index.php,这样就可以:

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

    我得到这样的东西:

    http://www.mysite.com/controller
    

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

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

    这很有魅力。但是,对于这个站点,我必须使用ZeusWeb服务器而不是Apache,我对它一点也不熟悉。宙斯有自己的重写规则,这样:

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

    会变成这样:

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

    有人能帮我改写宙斯的第一条规则吗?非常感谢您的帮助!

    1 回复  |  直到 16 年前
        1
  •  3
  •   John McCollum    16 年前

    明白了-以下对我来说很好:

    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}