Nginx下Urlrewrite的配置
之前在Apache下可以配成:http://localhost/show/1
这样的链接,实际URL是:http://localhost/index.php?m=index&c=show&id=1
现在到nginx下之后,访问
http://localhost/show/1会提示404,不知道这个该怎么写?
apache下的.htaccess是这样写的:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1
怎么对应到Nginx中呢?
网站找一个,可以把Apache的转成Nginx的,不过Nginx有些问题要写在config里
rewrite "^/(?!index\.php|robots\.txt|images|js|stylesheets)(.*)$" /index.php/$1 last;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
写在 “location / {}” 段里。
不过问题没这么简单,还有path_info的问题,我到这里走不下去了。
页:
[1]