Solve “no input file specified.” for Nginx after migrating the website.

Recently I migrated my website to a new server. After setting up everything, everything else seemed to be working okay. However, when I copied files for WordPress and accessed the home page, all I was getting was a single line of error:

no input file specified.

I thought something was wrong with Nginx’s config, but everything was the same. Checked every solution online and every setting for PHP and still didn’t solve the problem.

Finally, I tried to go through all the files inside the webroot, until I found the file .user.ini, which contained a rewrite rule for the old directory. When I moved to the new environment, the directory was also changed, making this rewrite fatal for the website. After removing the rule, problem solved.