Methods to reduce URL size?

So, we have a very large and complex website, which requires a lot of status information, which should be placed in the URL. In most cases, it is just a peach, and the application works well. However, there are (an increasing number) instances where the length of the URLs is becoming quite long. This causes huge problems in IE due to the URL length limit.

I am wondering what strategies / methods people use to shorten their URLs? In particular, I just need to reduce some parameters in the URL, maybe not all.

In the past, we entered some data of this state into the session ... however, this reduces the targeting in our application (which is really important). Thus, any strategy that can support targeting will be preferable.

Thank!

Edit: To answer some questions and clarify a bit, most of our parameters are not a problem ... however, some of them are dynamically generated with the possibility of being very long. These parameters can contain any legal data in the URL (which means that it’s not just numbers or just letters, it can be anything). Case sensitivity may or may not matter.

In addition, ideally, we could convert them to POST, however, due to the huge architectural changes necessary for this, I do not think that this is really possible.

+3
source share
5 answers

most of our parameters are not a problem ... however, some of them are dynamically generated with the possibility of a very long

I don’t see a way around this if you want to store complete status information in the URL without resorting to storing data in the session or permanently on the server side.

You can save a few bytes using some compression algorithm, but this will make unreadable URLs, most algorithms are not very efficient for small strings, and compression does not give predicted results.

The only other ideas that come to mind are

  • (query = > q, page = > p...)

  • , mod_rewritten /url/param1/param2/param3 ,

  • , "" (, , ..), (London = > 1, Paris = > 2...)

, , , , @Guido, . , : URL-,

example.com/?key=A23H7230sJFC

"" , .

, , , URL- , . , URL-... , .

, !

+2

, :

  • POST ( ), HTTP URL
  • ( ) , , , . , .
+3

URL- , ?

, , RESTful ( ) . REST in Practice (http://tinyurl.com/287r6wk) - .

+1

, . , (ASP.NET):

  • Server.Transfer HttpContext (PreviousPage .Net 2+), , .
  • Server.Transfer .
  • .
+1

Source: https://habr.com/ru/post/1763865/


All Articles