我有一个网站,所有请求都通过(无提示.htaccess)被无提示地重定向到index.php,然后PHP用于显示正确的页面(通过解析REQUEST_URI)。我想知道是否也可以将POST数据提交到假地址?我目前有这样的表格...<form action="/send-mail" method="post">我的.htaccess规则是# redirect mail posting to indexRewriteRule 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 indexRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule . index.php
3 回答
![?](http://img1.sycdn.imooc.com/5458683f00017bab02200220-100-100.jpg)
慕少森
TA贡献2019条经验 获得超9个赞
为了避免某些代理和Apache重写的问题,请传递POST数据或Content-Length: 0为空主体的请求设置标头。
最近,我遇到了一个问题,Apache GET在POST处理空主体时将我的请求转换为a 。因此,代替此:
curl -X POST https://example.com/api/user/123456789
传递Content-Length标题:
curl -X POST https://example.com/api/user/123456789 -H 'Content-Length: 0'
或在体内传递某些东西:
curl -X POST https://example.com/api/user/123456789 -d ''
- 3 回答
- 0 关注
- 264 浏览
添加回答
举报
0/150
提交
取消