Search code examples
wordpressrestwordpress-themingwordpress-rest-api

Wordpress Rest API route is showing 404 error at localhost


I have create a theme in WordPress 4.8. When i trying to connect Rest API is showing me 404 error at my local but on my domain it is working fine.

I have navigated to /etc/apache2/sites-enabled and opened 000-default

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

But still it is not working at my localhost.


Solution

  • Add a host name in localhost and try to access the API through host name

    For change host name goto /etc directory

    And open hosts file in text editor and add below line

    domain.com 127.0.0.1

    And save it, then restart the apache service

    It is working for me, hope this will help you.