您的位置:首页 > 其它

wordpress设置伪静态及设置后出现问题

2017-08-25 14:41 253 查看
一、如何设置给wordress设置伪静态?

           在workpress后台中设置-固态链接-自定义结构,输入/%post_id%.html,你再去看自己文章的链接,后面会多了html的后缀,就算是设计成功了

二、设置了伪静态后,出现了404not found nginx

         可能每种情况的处理方式是不同的,我这情况就是原先wordpress的配置不够完整

         在你原先的服务器里找到wordpress.conf ,这个文件我的路径是usr/local/nginx/conf 里

        然后把以下内容覆盖原来里面的内容,有些内容需要自己稍作修改:

server
{
listen xxxx;  //端口
server_name xxxxx.com;
index index.html index.htm index.php default.html default.htm default.php;
root  /home/wwwroot/xxxx/wordpress;

include none.conf;
#error_page   404   /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires      30d;
}

location ~ .*\.(js|css)?$
{
expires      12h;
}

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;
}
}
   覆盖之后,重启一次nginx,然后再去访问你带有html后缀的文章就可以访问了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐