假如您的网站是http://ningyuqiao.blog.51cto.com/网站是用wordpres搭建的,则只需要在nginx的配置文件中加入:
location / {if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }if (!-f $request_filename){ rewrite (.*) /index.php; } }
假如您的网站是http://ningyuqiao.blog.51cto.com/blog/网站是用wordpres搭建的,则代码需要改成
location /blog {if (-f $request_filename/blog/index.html){ rewrite (.*) $1/blog/index.html break; }if (-f $request_filename//blog/index.php){ rewrite (.*) $1/blog/index.php; }if (!-f $request_filename){ rewrite (.*) /blog/index.php; } }
时间: 2024-10-13 02:02:22