Fix WordPress with All Pages Returning 404 Not Found
Problem
I encountered a strange issue with WordPress: while the homepage loaded properly, all the other pages failed to do so. Instead, an error page displayed the message:
Not Found
The requested URL was not found on this server.
However, since I had migrated the files from another server, all the pages should already exist. I suspected that the .htaccess
file might be the culprit, but after hours of troubleshooting, I still had no clue.
Solution
As it turns out, in my case, the .htaccess
file was correctly configured. The issue lay elsewhere. To resolve it, edit the httpd.conf
file:
sudo vi /etc/httpd/conf/httpd.conf
Locate the section that starts with:
<Directory "/var/www/html">
Change the configuration from AllowOverride None to:
AllowOverride All
Finally, restart the server:
sudo systemctl restart httpd
After doing this, all the pages should render properly.