如何提交此表时,对用户隐藏网址是什么? [英] How to hide URL from users when submitting this form?
问题描述
我有很多很多领域的一种形式......
I have a form with many many fields...
在提交这些字段,我使用发布方法,它隐藏跟着 PHP 页传递的实际变量。
When submitting these fields, I use the POST method which hides the actual variables passed along to the PHP page.
不过,我无法摆脱的完整链接。
However, I can't get rid of the complete link.
从获取为发布也让所有的表单域不可见在网址,但是这部分仍是可见的更改:
Changing from GET to POST did make all the form fields invisible in the URL, but this part is still visible:
mydomain.com/bin/query#
我希望它是无形的,或者说:
I want it to be invisible, or say:
mydomain.com/search
我有的mod_rewrite
启用,因此有可能与的mod_rewrite
我想这样做,但我相信新以的mod_rewrite
,所以我需要你的帮助......
I have mod_rewrite
enabled so there is a possibility to do this with mod_rewrite
I think, but I am new to mod_rewrite
so I need your help...
我应该如何隐藏这个网址是什么?
How should I hide this URL?
如果你需要更多的投入,让我知道...
If you need more input let me know...
推荐答案
在提交的,你必须指定形式的操作属性。我认为你的行动是 mydomain.com/bin/query#
,但你希望它是 mydomain.com/search
。那么你应该使用 mydomain.com/search
withing动作attibute及以下改写:
When submitting a from you have to specify a action attribute for the form. I assume that your action is mydomain.com/bin/query#
but you want it to be mydomain.com/search
. Then you should use mydomain.com/search
withing the action attibute and the following rewrite:
RewriteEngine on
RewriteRule ^/search$ /bin/query [QSA,NC]
这将显示 mydomain.com/serach
在浏览器的URL。
That would show mydomain.com/serach
in the browsers URL.
修改:使用QSA标志,可以通过GET paremeters到您的查询脚本。数控使得重写不区分大小写。
EDIT: Using the QSA flag you can pass GET paremeters to your query script. The NC makes the rewrite case-insensitive.
您的形式应该是这样的:
Your form should look like this:
<form action="/search" method="post">
...
</form>
这篇关于如何提交此表时,对用户隐藏网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!