Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an html form that has multiple elements specially including text fields, select dropdowns,etc.

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!
Posted
Comments
Sergey Alexandrovich Kryukov 31-Jan-15 14:59pm    
What have you tried so far?
—SA
Member 11033015 1-Feb-15 12:22pm    
Thanks for your links Sergey.Before asking this question,I found some useful tutorials about mod_rewrite and regular expression including www.cheatography.com/davechild/cheat-sheets/regular-expressions/ & code.tutsplus.com/tutorials/an-in-depth-guide-to-mod_rewrite-for-apache--net-6708/ but couldn't solve my issue mentioned in my question,specially the case(NULL values) I mentioned above.

1 solution

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[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900