codeigniter(CI)在apache环境下的rewrite规则,codeigniterrewrite


http://www.phpno.com/ci-apache-rewrite.html


codeigniter(CI)在apache环境下的rewrite规则

2013年2月27日 | 标签:

如何在apache环境下配置codeigniter框架的rewrite规则?

解决方法(依localhost:8080[虚拟主机]配置为例) 第一步:配置apache配置文件 1、开启rewrite扩展(LoadModule rewrite_module modules/mod_rewrite.so)
2、开启虚拟主机配置(Include conf/extra/httpd-vhosts.conf)
3、添加监听端口8080(添加Listen 8080 和NameVirtualHost *:8080)
4、配置localhost:8080

第二步:配置.htaccess配置文件
<VirtualHost *:8080>
    ServerName *:8080
    DocumentRoot"F:/wwwroot/localhost_8080"
    <Directory F:/wwwroot/localhost_8080>
        AllowOverride All
    </Directory>
</VirtualHost>

htaccess文件内容如下
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond$1!^(index\.php|static|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1[L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>


第三部:修改codeigniter(CI)配置文件 $config['index_page'] = “index.php”; 改为 $config['index_page'] = “”; 相关链接:codeigniter在nginx环境下的rewrite配置 http://www.phpno.com/ci-nginx-rewrite.html

相关内容

    暂无相关文章