重写HTTP GET请求,在Apache中使用htaccess的POST [英] Rewrite HTTP GET request to POST in Apache using htaccess

查看:425
本文介绍了重写HTTP GET请求,在Apache中使用htaccess的POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要改变第三方PHP应用程序的行为,之后恢复更改返回不久。如果我能改写GET请求,让那些POST出他们,我会节省大量的时间,并可能避免在应用程序中的任何变化。

是否有可能改变GET 的http://网站/动作1参数= 1 进入POST 的http://网站/动作2 ,是 参数为POST请求的一部分,使用的.htaccess?

虽然,我也可以把第一个GET请求,到一个新的网页,其中会做POST到第二个URL自动(JavaScript)的,我想保持浏览器 - 服务器交互的数量尽可能低。


解决方案

  

是否有可能改变GET 的http://网站/动作1参数= 1 进入POST 的http://网站/动作2 ,用参数是POST请求的一部分,使用的.htaccess?


没有,这是不可能的。的GET和POST的是完全不同的要求,不同的请求头和不同的反应。重写引擎只影响URI和不能改变实际的请求。你将不得不依赖于JavaScript在浏览器的结束。

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.

解决方案

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?

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.

这篇关于重写HTTP GET请求,在Apache中使用htaccess的POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆