I've built an Ember front-end to a Wordpress site. The two are hosted on separate domains so when a user clicks "View page" in the Wordpress dashboard they are sent to the page on the API site rather than the front-end of the site.
I have created routes to match the Wordpress site, so I want to simply redirect everything from the API to the Ember site, with the exception of the dashboard and API endpoints. This will also be useful if, for whatever reason, someone navigates directly to the API in their browser.
So I want the following:
example-api.com/abc ~> example.com/abc
http://ift.tt/1nz3BoU ~> example.com/abc/def
http://ift.tt/1nz3BoW ~> work as normal
http://ift.tt/1nz3E42 ~> work as normal
I've tried the following so far:
RewriteEngine On
RewriteBase /
RewriteRule ^!(wp-json|wp-admin)($|/) http://example.com/$1 [R=301,L]
# 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
but that seems to redirect everything.
Next:
RewriteEngine On
RewriteBase /
RewriteRule ^(wp-json|wp-admin)($|/) /index.php [L]
RewriteRule ^index\.php$ - [L]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
# 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
as I thought that it would just forward the request to wp-json and wp-admin to index.php as usual... but it still redirects and I get an error "The requested URL /index.php was not found on this server."
Any help would be greatly appreciated. Ta.
Aucun commentaire:
Enregistrer un commentaire