nginx 配制.htaccess伪静态

来源:互联网 发布:剑灵捏脸数据灵男数据 编辑:程序博客网 时间:2024/05/18 23:52

nginx完全可以支持.htaccess文件,请按如下操作:

1、新建一个.htaccess文件,在里面输入规则,如本站的规则:

        rewrite ^(.*)/login.html$ $1/index.php?g=Index&m=Customer&a=login&type=2 last;        rewrite ^(.*)/loginout.html$ $1/index.php?g=Index&m=Customer&a=reset last;        rewrite ^(.*)/suites.html$ $1/index.php?g=Index&m=Index&a=index last;
2.    在需要添加伪静态的虚拟主机的server{}中引入.htaccess文件,

     include /home/dev/www/.htaccess; #主要是这步就OK了


5. 重新启动nginx 即可: