Problem: I encounter a weird problem in WordPress, where the homepage is able to load properly, but all the pages are failing to load. An error page display:

Not Found

The requested URL was not found on this server.

However, since the files were migrated from the other server, all the pages should exist already. And I was guessing the problem may be due to the .htaccess file, but still no clue after hours of troubleshooting.

Solution: Turns our for my case, the .htaccess file is correctly configure. Instead, edit the file:

sudo vi /etc/httpd/conf/httpd.conf

and find the section with

<Directory "/var/www/html">

Then change the config to from AllowOverride None to

AllowOverride All

Finally restart the server:

sudo systemctl restart httpd

All the pages are able to render properly now.