Mod Rewrite rule to Zeus Server rule (Codeigniter)

本小妞迷上赌 提交于 2019-12-09 03:19:50

问题


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

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]

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

would become this:

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!


回答1:


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}


来源:https://stackoverflow.com/questions/338511/mod-rewrite-rule-to-zeus-server-rule-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!