Is it possible to remove empty query string parameters from a URL with Apache's mod_rewrite?
A simple PHP script has an HTML form which submits to itself via GET. The HTML form has many input fields and when submitting via GET the resulting URL can end up being incredibly long, for example...
http://www.domain.org/script.php?var1=&var2=&var3=foo&var4= ... &var18=bar
This PHP script only processes query string paramters whose length is > 0. Empty query string params are ignored.
Is anyone aware of a method that can clear the empty variables within the query string so the URL would become?
http://www.domain.org/script.php?var3=foo&var18=bar
I realise I could do this within my PHP script by processing the GET array and building a new query string based on the GET array elements with values then do an HTTP header redirect. But that sounds pretty rubbish.
Is there was a better way of removing empty query string parameters from a URL?