Reputation: 1618
I need to change a behavior of third party PHP application and to revert changes back shortly after that. If I could rewrite GET requests and make POST ones out of them, I would save a lot of time and could avoid making any changes in the application.
Is it possible to transform GET http://website/action1?param=1
into POST http://website/action2
, with param being part of post request, using .htaccess?
Although, I can redirect the first GET request to a new page which will do POST to the second URL automatically (Javascript), I want to keep number of browser-server interactions as low as possible.
Upvotes: 6
Views: 3328
Reputation: 143886
Is it possible to transform GET
http://website/action1?param=1
into POSThttp://website/action2
, with param being part of post request, using .htaccess?
No, this isn't possible. A GET and a POST are entirely different requests, with different request headers and different responses. The rewrite engine only affects the URI and can't change the actual request. You're going to have to rely on Javascript on the browser's end.
Upvotes: 6