Nginx的 Rewrite 规则 (ShopEx )
2014-06-18 21:07
309 查看
Nginx配置ShopEx伪静态其实最简单了.在规则里添加判断是否存在文件或者目录(!-e),然后将它转发给根目录下的index.php进行处理就好了.
location / {
if (!-e $request_filename) {
rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
}
}
如果ShopEx放在其他目录中,只需要将"/"换成相对目录就可以了...例如放在shop文件夹中,如下面这个配置.
location /shop/ {
if (!-e $request_filename) {
rewrite ^/shop/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /shop/index.php?$1 last;
}
}
location / {
if (!-e $request_filename) {
rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
}
}
如果ShopEx放在其他目录中,只需要将"/"换成相对目录就可以了...例如放在shop文件夹中,如下面这个配置.
location /shop/ {
if (!-e $request_filename) {
rewrite ^/shop/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /shop/index.php?$1 last;
}
}
相关文章推荐
- PhpCms,ShopEx,EcShop,WordPress,PhpWind,Discuz在Nginx下的rewrite规则
- [亲测可用]ShopEx在Nginx上的的Rewrite伪静态规则
- nginx配置location总结及rewrite规则写法
- nginx的rewrite规则
- nginx url rewrite 的问号规则
- 转:Nginx 配置 location 总结及 rewrite 规则写法
- Nginx常用Rewrite(伪静态规则)
- nginx配置location总结及rewrite规则写法
- nginx的url重写[rewrite规则和参考]
- Nginx 手记(十三)rewrite规则
- 实例讲解Nginx下的rewrite规则
- Nginx 常用全局变量 及Rewrite规则详解
- apache与nginx的rewrite规则问题。
- Nginx 常用全局变量 及Rewrite规则详解
- nginx的Location的总结以及rewrite规则的总结
- nginx rewrite 规则
- nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法