Tag: rewrite

Debian+nginx+mediawiki的rewrite问题

Posted by – 2009-09-08

环境是Debian+nginx0.7.61+php5.3.0+mysql5.1.37 一、保证mediawiki目录下的LocalSettings.php文件中没有对做url重写的相关没配置,也就是注释或删除下边这个参数 #—————————-引用文字-开始—————————- #$wgArticlePath = “/$1″; #—————————-引用文字-结束—————————- 二、在nginx的vhost.conf进行rewrite的配置 #—————————-引用文字-开始—————————- location / { index index.html index.htm index.php; root /www/wwwroot/chengyongxu.cn; rewrite ^/wiki/index.php/([^?]*)(?:\?(.*))? /wiki/index.php?title=$1&$2; } #—————————-引用文字-结束—————————- #上边只加了一条规则,这样就可以通过访问 http://chengyongxu.cn/wiki/index.php/阿贾克斯 来访问到 http://chengyongxu.cn/wiki/index.php?title=阿贾克斯 了 三、如果要做rewrite,一定要保证同类的链接的一致性 不能阿贾克斯的链接是: http://chengyongxu.cn/wiki/index.php/阿贾克斯 而类似的巴塞罗那的链接是: http://chengyongxu.cn/index.php/巴塞罗那