CI框架在nginx/apache下的伪静态规则配置

时光6年前未分类1140

CI框架在NGINX下的伪静态规则修改:

1、location

location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}

location / {

       try_files $uri $uri/ /index.php?$uri&$args;

}

2、location ~ [^/]\.php(/|$)

location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;

#增加以下两行
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

include fastcgi.conf;
}

 

Apache配置方法:

1、修改httpd.conf,开启rewrite模块

LoadModule rewrite_module modules/mod_rewrite.so

2、将站点配置文件中

AllowOverride None 修改为 AllowOverride All 

3、在站点根目录添加.htaccess文件,内容如下:

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

相关文章

OSA安装过程中提示运行“install/auto_prepare.sh”安装错误

OSA安装过程中提示运行“install/auto_prepare.sh”安装错误

对于OSA安装过程中进行到如下步骤要求运行install/auto_prepare.sh 按提示在中断运行install/auto_prepare.sh后提示以下错误 instal...

Ubuntu系统下的Mysql数据库自动备份

Ubuntu系统下的Mysql数据库自动备份

1、SSH远程连接至数据库服务器 2、登录Mysql数据库,创建备份用户帐号并赋予权限 切换目录:cd /usr/bin/ 连接MYSQL数据库(帐号root 密码123456):m...

position:fixed 不兼容IE的解决方法

/**for FF/Chrome**/ .fix{ position:fixed; top:100px; left:200px; } /**for IE8、7、6**/ .ie-fi...

CentOS 6.5安装aria2

由于yum install aria2无法找到安装包,试了好几个源,都找不到,于是自己找了一些地址: 1、下载安装包: # wget http://ftp.tu-chemnitz.de/p...

帝国CMS忘记后台帐号密码

帐号密码重置方法: 重置帐号为tester ?密码为12346 1.找到phome_enewsuser表 添加一个帐号 username为tester password为...

LINUX文件权限的认识

LINUX文件权限的认识

1.Linux文件权限采用UGO模式控制,即U(用户)、G(组)、O(其他); 权限分为: R 表示read,可读。对应十进制数4,即2? W 表示write,可写。对应十进制数2,即2?。...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。