Mod Rewrite 规则到 Zeus 服务器规则(Codeigniter) [英] Mod Rewrite rule to Zeus Server rule (Codeigniter)
问题描述
我即将上线一个由 Codeigniter 驱动的网站.我想从 url 中删除 index.php,而不是这样:
I'm about to go live with a Codeigniter powered site. I want to remove index.php from the url so that instead of this:
http://www.mysite.com/index.php/controller
我得到了这样的东西:
http://www.mysite.com/controller
到目前为止,非常简单.过去我使用过 Codeigniter 文档提供的 mod-rewrite 规则:
So far, pretty straightforward. In the past I've used the mod-rewrite rule supplied by the Codeigniter documentation:
RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
这就像一个魅力.但是,对于这个站点,我必须使用 Zeus Web 服务器而不是 Apache,而且我根本不熟悉它.Zeus 有自己的重写规则,例如:
This works like a charm. However, for this site, I'm having to use a Zeus web server rather than Apache, and I'm not familiar with it at all. Zeus has its own rewrite rules such that this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*.html$ index.php
会变成这样:
match URL into $ with ^/[^/]*.html$
if matched then set URL = /index.php
谁能帮我改写宙斯的第一条规则?非常感谢您的帮助!
Can anyone help me rewrite the first rule for Zeus? Any help very gratefully received!
推荐答案
想通了 - 以下对我来说效果很好:
Figured it out - the following works nicely for me:
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}
这篇关于Mod Rewrite 规则到 Zeus 服务器规则(Codeigniter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!