Home
Support Forums

Getting wp-json to work on subdomain hosted elsewhere

I have my DNS records managed with Netlify.

My Wordpress install is on Digital Ocean. There, I successfully set up and installed Let’s Encrypt SSL on portal.ariatap.com and www.portal.ariatap.com with enforced SSL redirects.

If I visit https://ariatap.com/admin, I am successfully redirected to http://portal.ariatap.com/wp-admin.

However, if I visit https://ariatap.com/wp-json, I am redirected to https://www.ariatap.com/wp-json on Netlify’s server as Page Not Found. Also, if I visit https://portal.ariatap.com/wp-json, I get Page Not Found. And if I visit http://147.182.187.xx/wp-json I am redirected back to https://portal.ariatap.com/wp-json as not found.

Why is that? Wordpress API is enabled by default. What do I need to fix?

My records:

portal.ariatap.com|3600|A|147.182.187.xx
www.portal.ariatap.com|3600|A|147.182.187.xx
ariatap.com|3600|NETLIFY|ariatap.netlify.com
www.ariatap.com|3600|NETLIFY|ariatap.netlify.com

My _redirects:

/admin|https://portal.ariatap.com/wp-admin|200
/wp-json|https://portal.ariatap.com/wp-json|200

Inside my WP admin, my Wordpress Address and Site Address are both set as: https://portal.ariatap.com

My permalink structure is set to https://portal.ariatap.com/%postname%/.

I noticed there wasn’t an .htaccess file when I set up a WP droplet from the Marketplace. So, I added the default WP htaccess profile.

## BEGIN WordPress
<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

Regardless, with or without an .htaccess file, it still doesn’t resolve the URL. JSON URL remains as 404.

I’m not sure what fixed it – if it was adding the htaccess file or setting the permalink structure to anything but the default.

It appears to be working now.