Search code examples
wordpressdigital-oceanxml-rpcwordpress-jetpack

Wordpress xmlrpc.php 301 Moved Permanently


I have a site setup on Digital Ocean using their Wordpress droplet installer. I have then installed Jetpack.

The Site Health tool reported that Jetpack is not connected and that I should visit the Jetpack.com debugger. I did so and put my website in. The error I get:

XML-RPC is not responding correctly ( 200 )

When visiting the url mywebaddress.com/xmlrpc.php I just get redirected to the main URL of the site.

As recommended by Jetpack I went to a terminal and ran

curl -A 'Jetpack by WordPress.com' -d '<methodCall><methodName>demo.sayHello</methodName></methodCall>' https://mywebaddress.com/xmlrpc.php

When I do so I get the following coming back.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://mywebaddress.com/">here</a>.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at mywebaddress.com Port 443</address>
</body></html>

I have checked the .htaccess file and this contains only comments. I have checked /etc/apache2/apache2.conf and can find no redirects there.

So my question is, can anyone tell me what might be causing this 301 Redirect?


Solution

  • Found the answer I have just located this file:

    /etc/apache2/conf-enabled/block-xmlrpc.conf

    This had this inside

    <IfModule mod_rewrite.c>
        <Directory / >
            Redirect 301 /xmlrpc.php /
        </Directory>
    </IfModule>
    

    This file was causing the redirect. Have commented out its contents for now. I didn't create this, so I must assume DigitalOcean create it when doing the Wordpress one click install