WP-JSON / REST excluded from RewriteRule
-
I’m trying to setup a sitewide 503 response with a custom 503 error page all within htaccess on the root of a WordPress site. This works absolutely fine but I now need to exclude any POST/GET requests to /wp-json/ which I know translates to index.php/?rest_route
Feeling like I have tried every RewriteCond possible to exclude this but its not working. Has anyone else done this or can help point me in the right direction? I’ve been testing on a blank WP install so I know its not being affected by any customisation.
Few I’ve tried
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|ico) [NC]
RewriteCond %{REQUEST_URI} !^/wp-json/ [NC]
RewriteCond %{REQUEST_URI} !^/wp-json [NC]
RewriteCond %{REQUEST_URI} !^.*wp-json/ [NC]
RewriteCond %{REQUEST_URI} !^/wp-json.* [NC]
RewriteCond %{ENV:REDIRECT_STATUS} !=503
RewriteRule .* /maintenance.html [R=503,L]
The topic ‘WP-JSON / REST excluded from RewriteRule’ is closed to new replies.