重定向匹配更改帖子以获取 [英] redirectmatch changes post to get

查看:28
本文介绍了重定向匹配更改帖子以获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个独立的虚拟主机.在 www.一,我在 .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

除了在 POST 转换为 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 重定向到主域.

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

更新
我在网站上有一半的内部链接是用 www 写的,另一半没有它.所以我需要同时公开但不重复.我需要将 GET 作为 GET 转发,将 POST 作为 POST 转发.问题很大,我有 12000 页索引和很多表格.所以我首先在不更改代码的情况下寻找通用解决方案.我完全控制服务器.

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.

非常感谢

推荐答案

您使用 307 而不是 301 重定向以保留帖子数据,但如果用户确定要发送帖子数据,某些浏览器会向用户显示对话框,所以不是很漂亮.

You redirect using 307 instead of 301 to keep the post data, but some browsers show a dialog to the user if he is sure he want to sent the post data, so not real pretty.

但我更愿意从根本上解决问题.您将帖子发送到错误域的唯一方法是 html 表单引用错误的域(例如 <form action="www.d_blur_blur_s/public/main/loginGenerator.php" ...).只需修复 html.

But I'd rather go and fix the problem at the root. The only way you would get a post to the wrong domain is if the html-form refers to the wrong domain (e.g. <form action="www.d_blur_blur_s/public/main/loginGenerator.php" ...). Just fix the html.

不要担心重复的内容,因为搜索引擎从不发送后期请求,只会获取.您当前的解决方案应该可以防止重复内容.

Don't worry about duplicated content as search engines never send post-requests, only get. You current solution should do the trick to prevent duplicated content.

这篇关于重定向匹配更改帖子以获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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