天天看點

CI在nginx環境下去掉url中的index.php

在nginx環境下CI架構預設URL規則通路不了,出現500錯誤,如:

http://blog.php230.com/index.php/keywords      

今天在伺服器配置CI架構環境時,去除URL中的index.php,出現了預設URL規則通路不了的情況,隻能通過參數方式通路:

http://blog.php230.com/index.php?c=keywords      

配置:

location /{
	if (-f $request_filename) {
		expires max;
		break;
	}
	if (!-e $request_filename) {
		rewrite ^/(.*)$ /index.php/$1 last;
		break;
	}
}      
location /{
	try_files $uri $uri/ /index.php?$uri&$args;
}