是否可以重定向帖子数据? [英] Is it possible to redirect post data?

查看:80
本文介绍了是否可以重定向帖子数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,所有请求均通过(c0>)通过静默重定向(通过.htaccess),然后使用PHP(通过解析REQUEST_URI)显示正确的页面.

I have a website where all requests are redirected silently (via .htaccess) to index.php and then PHP is used to show the correct page (by parsing the REQUEST_URI).

我想知道是否也可以将POST数据提交到假地址?

I was wondering if it's possible to submit POST data to a fake address too?

我目前有这样的表格...

I've currently got my form like so...

<form action="/send-mail" method="post">

我的.htaccess规则是...

# redirect mail posting to index
RewriteRule send-mail index.php?send-mail [NC,L] 

我的index.php检查isset($_GET['send-mail'])是否正常.

但是,这似乎删除了应该发送给它的所有POST数据.

This however seems to drop off all the POST data that should be sent to it.

是否可以保存帖子数据?我不想使用GET,因为它不能发送太多信息,尽管使用简单的查询表可能不会有问题.

Is there a way to keep the post data? I don't want to use GET because it can't send as much information, though it might not be an issue with a simple inquiry form.

这是我的.htaccess,用于重定向到index.php

Here is my .htaccess for redirecting to index.php

# serve files and dirs if they exist please, otherwise send to index
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php

推荐答案

尝试一下:

# redirect mail posting to index
     RewriteRule send-mail index.php?send-mail [NC,P]

"P"的作用类似于"L",它停止处理规则,但它还告诉模块应将请求原封不动地传递给代理模块(意味着保留POST数据).

"P" acts like "L" in that it stops processing rules but it also tells the module that the request should be passed off to the proxy module intact (meaning POST data is preserved).

这篇关于是否可以重定向帖子数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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