Problems fixing a REST API 404 after Moving my WordPress Directory and updating Permalink Structure

I am running a self-hosted version of WordPress on a Linode VPS running Debian 9.

I was previously using WordPress on a /blog directory because I had a basic HTML site that I decided not to keep any longer, so I moved everything out of /blog and put everything back into the root directory after deleting my old site's contents.

I followed the steps provided here and updated my permalink settings and used Velvet Blues to update my URLs, as well as the Search and Replace script to update my SQL database.

I got some notifications from the Site Health tool, saying that my REST API and Jetpack settings were not working properly. Similarly, I tried to configure Yoast SEO to optimise my web site, but it kept returning an error. According to their article I opened this page in Chrome's DOM console and got this message.

Error

/wp-content/plugins/…min.css?ver=1.0.0:1 Failed to load resource: the server responded with a status of 404 () chrome-extension://c…ihfbcag/inject.js:1 Starting. jquery-migrate.min.js:2 JQMIGRATE: Migrate is installed, version 3.3.2 Error prwirepro-press_rele…n-ajax-handler.js:1 Failed to load resource: the server responded with a status of 404 () Error /wp-json/wp/v2/:1 Failed to load resource: the server responded with a status of 404 () wp-api.min.js:2 i Error /wp-json/yoast/v1/indexing/prepare:1 Failed to load resource: the server responded with a status of 404 () Error /wp-json/jetpack/v4/…pnonce=f0758236f2:1 Failed to load resource: the server responded with a status of 404 () chrome-extension://c…ihfbcag/inject.js:1 Starting. chrome-extension://c…ihfbcag/inject.js:1 Starting. chrome-extension://c…ihfbcag/inject.js:1 Starting. 2 /wp-json/yoast/v1/indexing/prepare:1 Failed to load resource: the server responded with a status of 404 () Error prwirepro-press_rele…ibution-admin.css:1 Failed to load resource: the server responded with a status of 404 ()  

Some of the references to press-rele are based on plugins I have installed in which they were using the /blog directory.

Update 1: I deleted some of those plugins, including Jetpack and Press Release Distribution, and the errors got shorter. The only one left is Yoast, which I am assuming is because I changed my permalink structure. It was previously

/index.php/%year%/%monthnum%/%day%/%post_id%/

and I changed it to */%post_name%/ and used their redirect tool to copy the code into my .htaccess file.

Also, when I go to anywhere on my site, like http://www.sensation-experience.com/blah-blah-blah, I see the generic 404 message from Apache, not the Page Not Found message in Wordpress, and I'm not sure why that is.

I have tried looking for a solution on multiple articles, but they are all based with the assumption that you are on a host, meaning that you only have access to an FTP folder and a web-based control panel, rather than having complete access to the box and doing everything yourself.

Update 2: I completely erased my WordPress site and dropped the database and created a new one. I imported my WordPress content using the WXR XML file. I am able to access WP Admin and other controls, but when I click on any of the pages on the homepage, I get the Apache 404 error message instead of WordPress's 404 not found page. I tried updating my permalink several times, but this had no effect. I also checked the .htaccess file, but everything looks good according to this article.

  • Can someone give me advice on how to get this fixed?

Topic troubleshooting linux permalinks server api Wordpress

Category Web


This sounds like it might be an issue with how the files for the main Apache2 configuration file and those found in the virtual host are written.

Adding the following line to the file * /etc/apache2/sites-available/hostname-le-ssl.conf before

<Directory /var/www/html/hostname/public_html/>
AllowOverride All

Then restart apache2.

$ sudo systemctl restart apache2

The files in /etc/apache2/sites-available are symlinked to /etc/apache2/sites-enabled.

ls -l /etc/apache2/sites-enabled/hostname-le-ssl.conf

lrwxrwxrwx 1 root root 65 May 26 2019 /etc/apache2/sites-enabled/hostname-le-ssl.conf -> /etc/apache2/sites-available/hostname-le-ssl.conf

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.