Semicolons as URL Query Separators


W3C recommends that all web servers support semicolon separators in the place of ampersand separators.

B.2.2 Ampersands in URI attribute values

The URI that is constructed when a form is submitted may be used as an anchor-style link (e.g., the href attribute for the A element). Unfortunately, the use of the “&” character to separate form fields interacts with its use in SGML attribute values to delimit character entity references. For example, to use the URI “http://host/?x=1&y=2” as a linking URI, it must be written or .

We recommend that HTTP server implementors, and in particular, CGI implementors support the use of “;” in place of “&” to save authors the trouble of escaping “&” characters in this manner.[/quote]

They don’t seem to be working on my site. Should they? Can they be configured to work?


GET: Array
[username] => John Smith;toggle=True;username2=Bob Roberts

The standard ampersand works as expected:


GET: Array
[username] => John Smith
[toggle] => True
[username2] => Bob Roberts

But then, as this stackoverflow page points out, they don’t seem to work on Google either:



That recommendation is from 1999, and has been pretty much universally ignored ever since. All browsers and most client libraries will always use “&” when constructing query strings; as such, most server software isn’t coded to recognize “;”.


Thanks for the information! I’m good with using ‘&’, but I was just curious as to why ‘;’ wasn’t working. Now I know. Thanks!


I, for one, have always programmed my own CGI scripts (in Perl) to support the use of semicolons as separators. (I think I started doing this around 1999 when that document was released, and have continued ever since.) Use of ampersands is problematic in HTML as the above document states, since you need to encode them in order for the page to validate.


um, 1999, static html was all i knew. and i used tables for layout…

anyway, semicolons are certainly more readable and make more sense semantically. it’s too bad there’s not a setting to get php to recognise them. it would also save bandwith! One semicolon vs five characters for [font=Courier]&[/font]


Supposedly, you can configure your server, folder, and/or individual script to support semicolon as a separator, although I haven’t any any luck with this. If anyone figures this out, please let us know what you did to get them to work.


What you’d have to do to get this (mostly) working would be to set arg_separator.input to “&;” in php.ini.


As a shared hosting client, can we modify php.ini directly for our site(s)? I assumed we would only be able to use the .htaccess and script-based overrides, which didn’t seem to work for me.


You can. It’s easiest to do so using PHP 5.3, following the instructions at