What are best practices for transferring a website to a new server to avoid issues like "No input file specified"?

When transferring a website to a new server, the "No input file specified" issue can occur due to incorrect server configurations. To solve this issue, you can update the server's configuration file to properly route requests to the PHP file. This can be done by adding or modifying the `location` block in the server configuration file for the website.

location / {
    try_files $uri $uri/ /index.php?$query_string;
}