用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4389|回复: 2
收起左侧

[HELP] Nginx下Urlrewrite的配置

[复制链接]
发表于 2012-1-12 11:16:14 | 显示全部楼层 |阅读模式
之前在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 [L]

怎么对应到Nginx中呢?

发表于 2012-1-12 11:54:16 | 显示全部楼层
网站找一个,可以把Apache的转成Nginx的  ,不过Nginx有些问题要写在config里
发表于 2012-3-13 11:43:51 | 显示全部楼层
PHP复制代码
 
rewrite "^/(?!index\.php|robots\.txt|images|js|stylesheets)(.*)$" /index.php/$1 last;
if (!-e $request_filename) {
    rewrite ^.*$ /index.php last;
}
 
复制代码

写在 “location / {}” 段里。
不过问题没这么简单,还有path_info的问题,我到这里走不下去了。

本版积分规则