首页 >后端开发 >php教程 >nginx伪静态求助 感谢

nginx伪静态求助 感谢

WBOY
WBOY原创
2016-06-23 14:19:50938浏览

Options +FollowSymLinks<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>###########################华丽丽的分界线##################上面是原来htaccess中的url重写配置(apache环境),thinkphp项目,有xx、yy、zz三个分组,xx是默认分组#下面是我要配置的虚拟机##########################################################server {	listen       80;	server_name  www.aaa.com;	location / {		root   E:/webroot;		index  index.html;		include		fastcgi_params;				rewrite  ^(.*)$		/index.php?$1 last;	}	error_page	404 = http://www.aaa.com/error404.html;	location ~ \.php$ {		root		E:/webroot;		fastcgi_pass	127.0.0.1:9000;		fastcgi_index	index.html;		fastcgi_param	SCRIPT_FILENAME  E:/webroot$fastcgi_script_name;		include		fastcgi_params;	}}


搞了一下午,无论访问www.aaa.com/yy 还是访问www.aaa.zz,   其实都指向了默认的xx分组
崩溃  求助   感谢


回复讨论(解决方案)


#把所有?源解析到index.php
rewrite ^(.[^~]*)~(.*)$ /index.php?mod=$1&action=$2 last;

例如
http://7di.net/a~b ?解析到 http://7di.net/index.php?mod=a&action=b

感谢楼上    已经搞定:
if (!-e $request_filename) {
rewrite  ^(.*)$  /index.php?s=$1  last;
break;
}

感谢楼上    已经搞定:
if (!-e $request_filename) {
rewrite  ^(.*)$  /index.php?s=$1  last;
break;
} ???

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn