使用REST API V2在WordPress中的http:// localhost / wp-json / wp / v2 / posts上显示404 [英] 404 on http://localhost/wp-json/wp/v2/posts in wordpress using REST API V2
问题描述
我在 http:// localhost / wp-json / wp / v2上收到404 / posts 路线。我将永久链接类型更改为纯文本。仍然有相同的问题。
I am getting a 404 on http://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-json / wp / v2 / posts上显示404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!