redirectmatch修改后得到 [英] redirectmatch changes post to get

查看:416
本文介绍了redirectmatch修改后得到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个分开的虚拟主机。在WWW上。一个,我已经instaled这个对的.htaccess只​​行

I have two separated vhost. On the www. one, I have instaled this only line on .htaccess

redirectMatch 301 ^(.*)$ http://d_blur_blur_s.com$1

如预期所不同的是在开机自检转换为GET的情况下工作的。
请注意,后有参数应用作为GET(我没有做到这一点,我不会改变它)我只是想避免重复的内容。我显示萤火虫踪影。

All works as expected except that in the case where the POST is converted to GET.
Please notice that the post has parametres as a get (i didn't do it, and I won't change it) i am just trying to avoid duplicated content. I am showing firebug trace.

我希望能有POST重定向与redirectmatch或其他诡计的主要领域。

I expect to have the POST redirected on the main domain with redirectmatch or other trick.

更新
我有一半写的WWW和没有它的另一半该网站的内部链接。所以,我需要保持公共但不重复。我需要被转发为GET和职位frowarded的职位。问题就大了,我有收录12000页,并且很多形式。所以我首先寻找在不改变code一个通用的解决方案。我完全控制德服务器。

Update
I have half of the internal links on the site written with www and the other half without it. So I need to keep both public but not duplicated. I need the GETs forwarded as GETs and the POSTs frowarded as POSTs. the problem is big, I have 12000 pages indexed, and lot of forms. So I am first searching for a generic solution without changing code. I full control de server.

多谢

推荐答案

从你的服务器上为任何要求你做,一个重定向响应,无论它是POST或GET请求,结果总是在你的客户做一个GET请求(除非你不知何故使得它不自动跟踪重定向 - 有时我这样做的卷曲,但我不知道任何广泛使用的浏览器使用这一功能可方便地为用户)。客户端浏览器采用由重定向提供的URL并将其视为为执行GET请求的URL。没有办法解决它,POST数据是由服务器丢弃,因为它的目的是为在原始URL服务器的资源。

A redirect response from your server for whatever request you made, regardless of it being POST or GET request, always results in your client making a GET request (unless you somehow enable it to NOT automatically follow redirects--sometimes I do this with curl, but I don't know any widely used browsers with this functionality available easily to the user). The client browser takes the URL provided by the redirect and treats it as a URL to perform a GET request. No way around it, the POST data is discarded by the server since it was intended for the server resource at the original URL.

如果您重定向的.htaccess以外,说在一个PHP文件,构建重定向响应,你唯一的选择是将POST参数转换成GET参数字符串,并将其添加到URL发送回结束客户端与您的重定向响应。

If you redirect outside of .htaccess, say in a PHP file to construct redirect response, your only option is to convert the POST parameters into a string of GET parameters and add it to the end of the URL you send back to the client with your redirect response.

我相当有信心,有​​没有办法做到自动POST参数追加在.htaccess文件中或在httpd.conf文件重定向是否使用重定向指令,或通过mod_rewrite的模块的改写指令。

I'm fairly confident there is not a way to do automatic POST parameter appending to redirect in the .htaccess file or in the httpd.conf files whether you use the redirect directive or the rewrite directive via the mod_rewrite module.

这篇关于redirectmatch修改后得到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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