CI框架搭建

CI 框架等移植到不一样等环境十分方便,只要改不多等配置:php

1.修改config.php 文件(修改这一个文件就能够跑通了):web

$config['base_url']    = 'http://127.0.0.1/bill/';

2.使apache支持 rewrite 模块(去掉index.php)apache

sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

修改配置 /etc/apache2/sites-available/default框架

    ServerAdmin webmaster@localhost

    RewriteEngine On
    RewriteOptions Inherit

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All 
        Order allow,deny
        allow from all
    </Directory>

3.添加 rewrite 规则 (网站根目录的 .htaccess 文件)ide

RewriteEngine on                                                                                                                 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /bill/index.php/$1 [L]