WordPress download file instead of opening site

file download image with wordpress logo to illustrate why wordpress download file instead of load

I encountered this problem with a WordPress site and this is how I fixed it.

  1. I checked my file manager to see how many .htaccess files I had uploaded to the root folder on my server.
    1. If I had multiple I would have deleted one and made sure the other had all the essential commands in it.
  2. I only had one, so I checked whether it was referencing a PHP version that my server may not be running.
    1. My .htaccess file reference PHP 70 and I was pretty certain this wasn’t what my server was running.
    2. 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.

 

Good luck.