Change wordpress api to the subdomain
<IfModule mod_rewrite.c>
# Redirecting dynamic subdomain urls to wp api
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$ [NC]
RewriteRule ^(.*)$ https://www.maindomain.com/wp-json%{REQUEST_URI} [R=301,NC,L,QSA]
</IfModule>