mod-rewrite规则宙斯服务器规则(codeigniter) [英] Mod Rewrite rule to Zeus Server rule (Codeigniter)

查看:210
本文介绍了mod-rewrite规则宙斯服务器规则(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

我得到的是这样的:

I get something like this:

http://www.mysite.com/controller

到目前为止,pretty简单。在过去,我已经使用了codeigniter文档提供的MOD-重写规则:

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]

这就像一个魅力。然而,对于这个网站,我不必使用宙斯的Web服务器,而不是Apache和我不熟悉它。宙斯有它自己的重写规则,这样的:

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规则宙斯服务器规则(codeigniter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆