I encountered this problem with a WordPress site and this is how I fixed it.
- I checked my file manager to see how many .htaccess files I had uploaded to the root folder on my server.
- If I had multiple I would have deleted one and made sure the other had all the essential commands in it.
- I only had one, so I checked whether it was referencing a PHP version that my server may not be running.
- My .htaccess file reference PHP 70 and I was pretty certain this wasn’t what my server was running.
- I commented out the line containing the PHP reference and voila I was back in business.
#AddHandler application/x-httpd-php70 .php
Brief Breakdown Why WordPress Tried To Download File Instead of Load Site
- The problem could be caused by using invalid/incorrect php/php.ini handler .htaccess code in the root .htaccess file.
- This was my problem.
- There could have been a php/php.ini handler code in the wp-admin .htaccess file when the wp-admin .htaccess file should not have any php/php.ini handler code in it.
- The php/php.ini handler .htaccess code should only be in the root .htaccess file. If that was the case I would have tried deleting the wp-admin .htaccess file and see if that solved the problem.
- There could be a .htaccess file higher up in the hosting account folder structure that has invalid php/php.ini handler .htaccess code in it.
- That is what I originally checked for in step 1.
- Another problem could be that the hosting provider was upgraded and not configured correctly.
- I think this shouldn’t be your first conclusion.
There are a couple other reasons why you may have run into this problem, but I think this is a good start to troubleshooting the problem.