Developing a decoupled front-end consuming the REST API...
I'm using create-react-app
so can enter a proxy
field corresponding to WP in my package.json
and write my calls like fetch('/wp-json/v2/pages/...')
if I run yarn start
from the front-end directory...
I'd love to actually have this theme in my wp-content/themes/my-theme
directory though
I'm no .htaccess
god
How can I make so that:
mysite/jibble/jabble
are handled by my SPA routingmysite/wp-admin/*
and mysite/wp-content/uploads/*
are still handled by Apache Developing a decoupled front-end consuming the REST API...
I'm using create-react-app
so can enter a proxy
field corresponding to WP in my package.json
and write my calls like fetch('/wp-json/v2/pages/...')
if I run yarn start
from the front-end directory...
I'd love to actually have this theme in my wp-content/themes/my-theme
directory though
I'm no .htaccess
god
How can I make so that:
mysite.com/jibble/jabble
are handled by my SPA routingmysite.com/wp-admin/*
and mysite.com/wp-content/uploads/*
are still handled by Apache Ok this probably has a superfluous few lines but this works for me:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^static/(.*)$ /wp-content/themes/MYTHEME/static/$1 [R=301,NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>