15

Let me start by saying that I have moved dozens of websites from one server to another, without issue.

I recently moved a website and when the URL is visited, a file named "download" with no extension and only a 1KB file size downloads automatically. I backed up all files and downloaded the databases using four different methods, just to make sure: BackWPup, BackUpWordPress and manually by zipping the files & downloading the files via FTP.

The original website works perfectly on the original server.

I used the method I've always used when moving to a new server.

On the new server:

  1. Create new DB, user and import database
  2. Upload files and unzip
  3. Edit wp-config.php with new DB name, user, password
  4. Change the website URL using the functions.php method in the WordPress Codex, here - http://codex.wordpress.org/Changing_The_Site_URL

I should also mention that I uploaded the site to three different servers (including a sub-domain on the original server), all with the same result.

In addition to the methods mentioned above, I tried the following things to try to troubleshoot:

  1. Changed the "plugins" folder name to see if a plugin was causing the error
  2. Changed the active theme folder name to see if the theme was causing the error
  3. Changed WP_DEBUG to "true" in wp-conig.php - But the site never loads, so no errors are displayed.

Currently, the erroneous website is located at - http://cgdev.webworksplayground.com/

Thanks for the help.

4 Answers 4

14

I guess you haven't taken a look at the file that is served for downloading, if so you would have seen this:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

Which could have been easily identified as the content of the index.php file inside the root of your WordPress installation.

Regarding the cause(s) for this behavior, check if you are having the correct file permissions, make sure your htaccess file is correct. Besides that some other hosting related settings could be incorrect, see Codex: Hosting WordPress (not very informative though) or on here What are best practices for configuring a server for Wordpress sites?.

The above should get you started. I actually pretty much did have to make a - somewhat educated - guess about the reason(s), so inspect that deeper yourself, but I'm fairly certain the origins are in the general area that I addressed.

5
  • 6
    Thanks for the reply. The .htaccess had this added to the file - # Use PHP54 Single php.ini as default AddHandler application/x-httpd-php54s .php After removing it, all seems to work well. Commented Aug 20, 2014 at 12:12
  • My pleasure. Ok, thats a directive to use PHP 5.4 with Suhosin patch. Not sure why it won't work with it. I have used similar ones and never had a problem. Maybe ask your hosters support. @TravisPflanz Commented Aug 20, 2014 at 14:21
  • Hello @something , I am also facing the same issue. I checked my .htaccess file and found that my problem is similar to travis' problem. I also cleared that extra code from the file but when I enter to update permalinks the same code gets rewritten in the file. Commented Jul 30, 2017 at 19:23
  • @KeyurPatel It might be the server configuration, take al ook at the links in my answer for more information. Commented Jul 30, 2017 at 20:47
  • In my case clearing browser site data fixed the problem (In Chrome: settings > Site Settings > See all cookies and site data > delete applicable data). My issue came on the heels of a big php module installation.
    – Eric H
    Commented Nov 12, 2019 at 0:28
5

Simple steps

1 - Go to filemanager through cpanel or FTP

2 - Delete the .htaccess (make sure you have created a backup)

3 - Open your website and set the permalinks it will create a new .htaccess file .

4 - Enjoy!

I just deleted .htaccess file and it is working perfectly now :)

3
  • 1
    Deleting .htaccess works fine and regenerate new .htaccess automatically. Thanks Commented Oct 25, 2017 at 20:12
  • Yes. This technically works, but if the .htaccess file has anything else in it needed by the website, it will all be deleted. Commented May 21, 2020 at 20:15
  • basically recreating the .htaccess file works, but don't be fooled by Chrome caching. Commented Mar 2, 2021 at 4:01
1

You can also simply add the following line to .htaccess as well which allows variations of PHP just to be on the safe side.

AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
0
1

The mu-plugins adds a handler when you save the configuration AddHandler application/x-httpd-php71 .php making the page being downloaded instead of processed.

If you just remove the line from your .htaccess (or delete the file), the line will come back at each settings save.

A better solution is to modify by ftp the file wp-content/mu-plugins/endurange-php-edge.php

Just comment (by adding "//" in front of the line) the line 20:
// $this->hooks();

Reference: htaccess problem after saving Settings

Not the answer you're looking for? Browse other questions tagged or ask your own question.