nginx php和html伪静态

phpstudy中设置:  

try_files $uri $uri/ /index.php?$query_string;(php的伪静态)

try_files $uri $uri/ /index.html?$query_string;(html的伪静态)

  

location ~* (runtime|application)/{
	return 403;
}
location /api/ {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /api/index.php?s=$1 last;break;
	}
}
location /member/ {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /index.html?s=$1 last;break;
	}
}
location /tour/ {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /index.html?s=$1 last;break;
	}
}
location /admin/ {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /index.html?s=$1 last;break;
	}
}
location /new/ {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /index.html?s=$1 last;break;
	}
}
location /news/ {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /index.html?s=$1 last;break;
	}
}
location /edit {
	if (!-e $request_filename){
	   rewrite  ^(.*)$  /index.html?s=$1 last;break;
	}
}

  

phpstudy 与 nginx中单独设置:

if (!-e $request_filename){rewrite ^(.*)$ /index.php?s=$1 last; break;}
posted @ 2020-10-26 10:52  Smile☆  阅读(969)  评论(0编辑  收藏  举报