hitrobinho 发表于 2011-8-26 13:07:48

CI网站与其他网站共存

CI放在网站根目录下,想在这个目录下创建一个目录abc,abc里不用ci框架,用php原始的语法,但是访问网站http://localhost/abc,就会被ci给指走了,肿么办?

jeongee 发表于 2011-8-26 13:19:38

rewrite规则里排除掉这个文件夹

hitrobinho 发表于 2011-8-26 14:12:11

jeongee 发表于 2011-8-26 13:19 static/image/common/back.gif
rewrite规则里排除掉这个文件夹

哇咔,肿么写?在哪写?

spt119 发表于 2011-8-26 14:26:25

一般的虚拟主机(价格较低的),基本都不支持rewreite。所以单纯依靠rewrite怕是不行。
实在不行,就开同级目录吧。就是url上多了个目录名。

jeongee 发表于 2011-8-26 15:20:32

spt119 发表于 2011-8-26 14:26 static/image/common/back.gif
一般的虚拟主机(价格较低的),基本都不支持rewreite。所以单纯依靠rewrite怕是不行。
实在不行,就开同级 ...

他明显用了rewrite了嘛

吖晋 发表于 2011-8-26 15:44:06

hitrobinho 发表于 2011-8-26 14:12 static/image/common/back.gif
哇咔,肿么写?在哪写?

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

spt119 发表于 2011-8-29 10:30:07

jeongee 发表于 2011-8-26 15:20 static/image/common/back.gif
他明显用了rewrite了嘛

localhost,用啥都行。但到production环境,如果主机不支持,那就是个噩梦。

killbug 发表于 2013-12-24 10:14:31

搞了两天,终于用nginx配合CI搞定了这个重写功能了。

不过我的目标不同:
1、根目录按照普通网页方式访问;
2、子目录下放很多不同的CI网站。

我的配置思路是在NGINX中仅配置一个根目录,但下面对各个子目录配置CI的重写规则,如:
server {
      listen 80;
      server_name xxx.yyy;
      root /data_dir;
      include extra/my.inc;

      location /ci_dir/
      {
                if ($request_filename !~* /ci_dir/(index\.php|templates)){
                        rewrite ^/ci_dir/(.*)$ /ci_dir/index.php?$1 last;
                }
      }

      location /pri/
      {
                return 404;
      }
}
页: [1]
查看完整版本: CI网站与其他网站共存