I have a very strange problem with WordPress. I transferred website from one domain to another with the use of Duplicator plugin.

Everything works just fine but when I change something in settings and save them and after that go to the website or individual pages, this page is downloaded to my computer.

For example if my website is example.com after I go to that page the file is downloaded to my computer with the name example.com (.com is extension of the file).

If I delete .htacces file I can access main page again but other permalinks do not work.

I tried changing .htacces with the default one given at WordPress webpage and everything works well until I change something in settings and save it again.

I tried reinstalling WordPress via wp-admin/update-core.php. Everything went well with re-installation but the problem is still here.

After I save the settings my htaccess remains the same except one line:

AddHandler application/x-httpd-php70 .php

which is added at the beginning:

# BEGIN WordPress
AddHandler application/x-httpd-php70 .php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

After I manually delete that line everything works well again until I save settings again. Just for information my current php version is 7.1. I tried changing it in cPanel to 7.0 but that also didn’t help.

Anyone have idea what this could be and how to solve it?

1
1

Ok I figured this out and I am providing answer just for the case that someone else experiences this problem.

The problem was in the plugin that was used on the original automatic installation of the WordPress done via Mojo Marketplace.

The name of the plugin was Endurance PHP Edge and it was not in the normal plugin folder so it could not been deactivated. This plugin is used in order to setup PhP version in the htaccess file after saving it. It looks like this:

    if ( ! defined( 'WPINC' ) ) { die; }

define( 'EPE_VERSION', 0.1 );

if ( ! class_exists( 'Endurance_PHP_Edge' ) ) {
    class Endurance_PHP_Edge {
        function __construct() {
            $this->hooks();
        }

        function hooks() {
            add_filter( 'mod_rewrite_rules', array( $this, 'htaccess_contents' ), 99 );
        }

        function htaccess_contents( $rules ) {
            if ( file_exists( '/opt/cpanel/ea-php70/root/usr/bin/php-cgi' ) ) {
                $default_handler="application/x-httpd-ea-php70";
            } else {
                $default_handler="application/x-httpd-php70";
            }

            $handler = get_option( 'epe_php_handler', $default_handler );
            $handler="AddHandler " . $handler . ' .php' . "\n";
            return $handler . $rules;
        }
    }
    $ebc = new Endurance_PHP_Edge;
}

and this was adding that line in my .htaccess file.

Why this line is causing every page to download is beyond my comprehension.

The solution was simply to delete mu-plugins folder which can be found inside wp-content folder.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *