I have a wordpress site that for various reasons needs a 302 redirect if a certain page is hit with a POST request, any other request should action as usual (ie GET requests). All the methods I have tried however simply perform the redirect regardless of the request method.
RewriteCond %{REQUEST_METHOD} POST
Redirect 302 /gallery /wp-json/posts
Anybody have any ideas?
You’ve got the syntax from two entirely different, and competing modules there: mod_rewrite (RewriteCond) and mod_redirect (Redirect), as there’s no connection between the two mod_redirect will always redirect, as there’s no condition. Similarly you have a condition for a mod_rewrite redirection, but not the actual Redirection directive (RewriteRule). Anyway of the two modules use just use mod_rewrite eg.