|
Error 404: WordPress REST API on a localhost |
WordPress runs on my Manjaro distro of Arch Linux. But the REST API does not work at all. I have tried:
- Install the plugin via git pull https://github.com/WP-API/WP-API.git
- Set the folder permissions to 777
- Reset the WordPress database after pretty links disaster.
- Reinstall the plugin from git pull https://github.com/WP-API/WP-API.git
Mostly I get error 401, but sometimes it's 502.
Ideas?
---
A fellow lecturer suggested to edit /etc/httpd/conf/httpd.conf :
Quote from
this page:
"When the server finds an .htaccess
file (as specified by AccessFileName
), it needs to know which directives declared in that file can override earlier configuration directives.
Only available in sections
AllowOverride
is valid only in
sections specified without regular expressions, not in
,
or
sections.
When this directive is set to None
and AllowOverrideList
is set to None
, .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess
files in the filesystem.
When this directive is set to All
, then any directive which has the .htaccess Context is allowed in .htaccess
files."
After that a directory as added that pointed to WordPress:
AllowOverride All
AllowOverrideList All
Require all granted
In a WordPress forum an author suggested to change the permalinks to "post name". The .htaccess file had to be created, with this content:
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
After a restart of Apache the REST API responded correctly:
# sudo systemctl restart httpd
Et voila!
|
Json from the REST API |
Install themes / plugins
In order to install themes and plugins the owner of the folders should be the Apache user http, so:
# chown -R http:http wordpress/
And so the WordPress installation is ready to fly on the localhost.