更新:在PHP中的问题,mod_rewrite和POST方法,$ _ POST总是空 [英] UPDATED: mod_rewrite and POST method in PHP problem, $_POST is always empty

查看:104
本文介绍了更新:在PHP中的问题,mod_rewrite和POST方法,$ _ POST总是空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用mod_rewrite显示ADRESS在更可读的方式的页面,而不是

Im using mod_rewrite to display adress of pages in more readable way, instead of

http://127.0.0.1/index.php?article=contact

我得到了

http://127.0.0.1/contact

当发送即时消息的形式,全部由index.php文件处理,所以我直接形式的行动,以当前显示的页面,但$ _ POST始终是空的,开放的形式块看起来像这样

when im sending form, all is processed by index.php, so i direct action of form to currently displayed page but $_POST is always empty, opening block of form looks like this

<form method="post" action="http://127.0.0.1/contact">

我的mod_rewrite推出之前的所有是伟大的工作,但现在的mod_rewrite似乎会导致问题。

before i launched mod_rewrite all was working great, but now mod_rewrite seems to cause problems.

请告诉我怎么在PHP中改变,Apache的配置文件,或者还能做什么,使与重写endabled $ _ POST工作

Please tell me what to change in PHP, Apache configuration files, or what else to do to make $_POST work with rewrite endabled

这里是被请求重写规则

RewriteEngine on
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule \.(css|jpe?g|gif|png)$ - [L]
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&va=$2 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&va=$2&vb=$3 [L]

在此先感谢

阿米尔

推荐答案

这重写规则做了的重定向的,所以浏览器反而会去这个地址与一个GET请求;因此,POST数据永远是空的。

This rewrite rule does a redirect, so the browser will instead go to this address with a GET request; the POST data will therefore always be empty.

RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]

这篇关于更新:在PHP中的问题,mod_rewrite和POST方法,$ _ POST总是空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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