zoukankan      html  css  js  c++  java
  • 基于linux下LNMP环境设置wordpress伪静态

    1.编辑配置文件

    # vi /usr/local/nginx/conf/vhost/你的网站根目录.conf    
    # vi /usr/local/nginx/conf/nginx.conf      在server(server模块中)中添加 include rewrite/wordpress.conf;   注意:不同端口,都需要这条配置。
    # vi /usr/local/nginx/conf/rewrite/wordpress.conf     注意:你可以选择将下面代码写入wordpress.conf中,也可以选择直接写入nginx.conf的server模块中。

    2.添加内容

    location / {
            #try_files $uri $uri/ /index.php?$args;
            index index.html index.php;
            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;
            }
    }

    3.在 wordpress 后台 “设置” -> “固定链接” -> 点击 “自定义结构”输入 /%post_id%.html

    有帮助,想了解更多,欢迎访问我的主页秋风荡

  • 相关阅读:
    centos 7安装配置vsftpd
    lvs和haproxy机器必须注意的三个参数
    用python 脚本实现zabbix对java端口报警
    git的下载地址
    看的一篇很好的博客
    学习内容
    数组一些用法
    dom
    dom1
    for的基础
  • 原文地址:https://www.cnblogs.com/hjjjjhd/p/11065114.html
Copyright © 2011-2022 走看看