百度云主机wordpress设置伪静态方法

第一步:

首先用远程连接软件连接到百度云主机的网站空间,然后打开webroot文件夹,找到app.conf下载下来,并使用记事本打开,把里面的内容删除,然后将以下代码粘贴上去,保存。改好之后上传到原目录覆盖。

handlers:

      # 设置默认首页

      - url : /

        script : home.php

      # URL Rewrite,所有的图片都访问其他地址

      - regex_url: /picture/(.*\.gif)

        static_files: static/$1

      # URL Rewrite,所有的html访问都转换为php访问

      -regex_url:^/([a-z0-9]*)\.html$

       script: /process.php?$1

      # 重定向访问处理

      -regex_url:^/permission_page$

       status_code: 302

       location: http://example.com/error.html

      # 处理404错误

      - errordoc : 404 /error/404.html

      - errordoc : 403 /error/permission.html

      # 过期处理

      - expire : .jpg modify 10 years

      - expire : .swf modify 10 years

      - expire : .png modify 10 years

      - expire : .gif modify 10 years

      - expire : .JPG modify 10 years

      - expire : .ico modify 10 years

      # mime 设置默认首页

      - mime: .txt text/plain

      - mime: .json application/json

- rewrite_not_exist: (.*)

  script: /index.php/$1

第二步:

在电脑上新建一个记事本文件,在里面写入以下代码:

rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;

if (!-e $request_filename) {

rewrite ^.+?(/wp-.*) $1 last;

rewrite ^.+?(/.*\.php)$ $1 last;

rewrite ^ /index.php last;

}

然后将文件名修改为bcloud_nginx_user.conf,上传到刚才的目录

第三步:

登录自己的wordpress后台,点击“设置-固定链接-自定义结构”,输入/%post_id%.html,然后点击保存。(可以根据自己的需求设置)

第四步:

登录百度云主机控制面板,点击左边的“常用操作-站点启停-重载站点服务”,完成后再打开自己的网站首页,随便点击一篇文章,就发现已经完成了。

参考网址:https://jingyan.baidu.com/article/414eccf650eb876b431f0a80.html

猜你喜欢

转载自blog.csdn.net/qq_24127447/article/details/85931027