在网站根目录创建文件 bcloud_nginx_user.conf
将伪静态规则写在中括号内 location / { …… }
下面是一位客户从百度的Lighttpd环境迁移到Nginx环境之后,我帮他修改的规则。
0 1 2 3 4 5 6 7 8 9 |
location / { rewrite ^(.*)/admin_ccc/index.php/(.*).html$ $1/admin/index.php?s=$2 last; rewrite ^(.*)/admin_ccc/kindeditor/plugins/baidumap/map(.*).html$ $1/admin/kindeditor/plugins/baidumap/map.html?$2 last; rewrite ^(.*)/Search/index.html?name\=(.*)$ $1/index.php/Search/index.html?name=$2 last; rewrite ^(.*)/Common/verify.html?(.*)$ $1/index.php/Common/verify.html?$2 last; rewrite ^(.*)/(Feedback|Inquiry)/$ $1/index.php?s=$2 last; rewrite ^(.*?)/((?!sitemap).*).html$ $1/index.php?s=$2 last; } |
写完规则,记得重启nginx,才能去吃饭哦!!!
相关文档: