1. 程式人生 > >nginx 配置URL重寫(實現隱藏index.php)

nginx 配置URL重寫(實現隱藏index.php)

正則方式:


location / {
	root html/xxxx/yyyy/;
	index index.php index.html;
	if (  !-e  $request_filename ){
		rewrite(.*) /index.php/$1;
	}
}

/auth/login
index.php?/auth/login

try_files方式:
nginx.conf

location / {
    root html/dddai/public/;
    index index.php index.html;
    try_files $uri /index.php?$uri;
}