Is it better to use a "?" or a ";" in a URL?

109 Views Asked by At

In my application, I redirect an HTTP request and also pass a parameter. Example:

http://localhost:9000/home;signup=error

Is it better to use a ; or shall I use a ? i.e. shall I do http://localhost:9000/home;signup=error or http://localhost:9000/home?signup=error?

Are the above two different from each other semantically?

1

There are 1 best solutions below

0
On

The ? is a reserved character; I have read that this is both valid and invalid, but I have used it for 'slugs' when templating.

Should you choose to use it, percent-encode the query string using %3F which is not human readable, but will produce the ?. (An encoder is recommended)

Perhaps you will find a more suitable solution for your redirects by adding an .htaccess file to your project.