将多个可选的$ _GET参数转换为清理URL [英] convert multiple optional $_GET parameters to clean URLs
问题描述
我有一个html表单,其中包含多个元素,特别包括文本字段,选择下拉列表等。
我正在寻找的是,每当表单时提交,我希望URL地址栏中的表单获取参数更改为更多用户和搜索引擎友好的URL。
例如,提交后,我想要:
www.example.com/index.php?par1=val1&par2=val2&par3=val3&par4=&par5=val5
更改为:
www.example.com/val1/val2/val3/val5/
正如您在上面的示例中所看到的,如果参数值为NULL或等于特定值(例如此处为par4),我希望该值不会出现在结果友好URL中。
我怎么能实现这个目标?我想我应该使用apache mod_rewrite但我是mod_Rewrite的初学者,感谢你帮助我。
提前谢谢!
I have an html form that has multiple elements specially including text fields, select dropdowns,etc. 这篇关于将多个可选的$ _GET参数转换为清理URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
http://httpd.apache.org/docs /2.0/misc/rewriteguide.html [ ^ ]。
另外,为了一般理解,请参阅以下内容:http://en.wikipedia.org/wiki/Rewrite_engine [ ^ ]。
What I'm looking for, is that whenever the form is submitted, I want the form get parameters in the URL address bar to change to a more user & search engine friendly URL.
As an example, after submission, I want:
www.example.com/index.php?par1=val1&par2=val2&par3=val3&par4=&par5=val5
to change to:
www.example.com/val1/val2/val3/val5/
And as you can see in the above example,if a parameter value is NULL or equal to a specific value(e.g par4 here),I want the value not to appear in the result friendly url.
How can I achieve this?I think I should use apache mod_rewrite but I'm a beginner in mod_Rewrite and appreciate your helping me with this.
Thanks in advance!If you are a beginner with Apache URL rewrite (mode_rewrite), you just need to learn it. There is no other way. Please see this guide:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html[^].
See also, just in case, for general understanding: http://en.wikipedia.org/wiki/Rewrite_engine[^].