使用REST API V2在WordPress中的http:// localhost / wp

编程入门 行业动态 更新时间:2024-10-08 20:31:14
本文介绍了使用REST API V2在WordPress中的http:// localhost / wp-json / wp / v2 / posts上显示404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在 http:// localhost / wp-json / wp / v2上收到404 / posts 路线。我将永久链接类型更改为纯文本。仍然有相同的问题。

I am getting a 404 on localhost/wp-json/wp/v2/posts route. I changed permalink type to plain. Still got the same issue.

如果有用,我是ubuntu 16.04台式机,最近从15.10升级,遇到了php5.6到7.0升级的问题。现在是在php 7.0上

If its useful, I am ubuntu 16.04 desktop recent upgrade from 15.10, suffered issues with php5.6 to 7.0 upgrade. Am now on php 7.0

Edit1:尝试了其他永久链接设置组合,无结果!

Tried every other permalink setting combination, no results!

推荐答案

您需要授予wp-content文件夹的权限。对于更改权限,请在终端中使用以下命令。

You need to give permission to your wp-content folder. For the change the permission please use below command in terminal.

sudo chmod -R 755 wp-content/

更改权限仍然显示404错误后,请允许AllowOverride用于apache,步骤如下:

After the change permission is still show 404 error then allow AllowOverride for apache, below is the step:

导航到 / etc / apache2 / sites-enabled 并打开 000-default

所有 AllowOverride 变量均设置为None,我将其替换为 All 。

All of the AllowOverride variables were set to None, which I replaced with All.

此更改后,使用以下命令启用mod:

After this change enable mod using below command:

a2enmod rewrite

然后重新启动下面的apache服务是命令:

And restart the apache service below is the command:

sudo service apache2 restart

更多推荐

使用REST API V2在WordPress中的http:// localhost / wp

本文发布于:2023-11-28 03:05:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640718.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:API   REST   WordPress   wp   localhost

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!