PROBLEM:
Like any modern web platform, much of how the WordPress interface communicates with the server is through AJAX commands, which are directed to wp-admin/admin-ajax.php. On a recent install of WordPress, these POST requests were all returning as 404s, disabling much of WordPress. Here’s what I did to fix that and get the site working.
Today, I’ve been setting up a website for a local nonprofit in my community. Since it’s a small site that isn’t likely to get a ton of traffic, I decided to run it on the shared hosting plan that I have through A Small Orange – https://asmallorange.com/
On my first attempt to set up the site, I downloaded the package latest.zip from WordPress.org and uploaded it to a subdomain that I set up on on the shared hosting server. I then ran the install wizard to set up the site. Everything seemed to be working okay, until I began inputting content and found that while Post Back requests were working fine, the AJAX requests were all returning 404s. This meant that much of the site’s basic functionality, including customizing the theme, adding media and managing posts and pages wouldn’t work.
After scratching my head for a while, trying everything I could find through Googling and chatting with tech support for my hosting provider, I was at a loss.
SOLUTION:
After striking out at every attempt I made to remedy the problem, I knew I had to re-install WordPress on the server. But it seemed likely that if I followed the same approach that I had earlier, I would get similar results and face the same 404 problem yet again. So I needed another way to go about installing WordPress.
So I logged into the hosting provider’s cPanel interface and ran the WordPress Install Script from the Softaculous component. And it worked! I believe this would also work if your cPanel is configured with script.aculo.us.
Who knows why. Perhaps Softaculous set the permissions for the files differently than when I’d uploaded them directly, or maybe it configured Apache differently, but who cares. The thing works now. And hopefully this will help you too!