是否可以重定向帖子数据?

我有一个网站,所有请求都通过(无提示.htaccess)被无提示地重定向到index.php,然后PHP用于显示正确的页面(通过解析REQUEST_URI)。


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


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


<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数据。


有没有办法保留帖子数据?我不想使用GET,因为它不能发送太多信息,尽管使用简单的查询表可能不会出现问题。


这是我.htaccess重定向到的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


呼唤远方
浏览 251回答 3
3回答

慕少森

为了避免某些代理和Apache重写的问题,请传递POST数据或Content-Length: 0为空主体的请求设置标头。最近,我遇到了一个问题,Apache GET在POST处理空主体时将我的请求转换为a 。因此,代替此:&nbsp;curl -X POST https://example.com/api/user/123456789传递Content-Length标题:&nbsp;curl -X POST https://example.com/api/user/123456789 -H 'Content-Length: 0'或在体内传递某些东西:&nbsp;curl -X POST https://example.com/api/user/123456789 -d ''
打开App,查看更多内容
随时随地看视频慕课网APP