Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Can't be done. An arbitrary URL contains many characters -- let's say 100. A shortened URL contains maybe 5. You can't use 5 characters to reconstruct 100 without a lookup table of some kind; there's simply not enough information available to do it.</p> <p><strong>EDIT 1:</strong> Well, if you don't actually need a URL <em>shortener</em> (then why did you write that?), there are plenty of options. I'd go for plain Base64 encoding, perhaps after a pass through zlib or another compressor (that might make URLs longer; you'll have to measure if it helps or not).</p> <p><strong>EDIT 2:</strong> Standard Base64 does use three non-alphanumeric characters: <code>+</code>, <code>/</code>, and <code>-</code>. If these are unacceptable, you have a couple of options:</p> <ol> <li><p>Modified Base64. <a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">Wikipedia suggests</a> "modified Base64 for URL", which drops all <code>=</code> and replaces <code>+</code> and <code>/</code> with <code>-</code> and <code>_</code> respectively. But those still aren't alphanumeric, which doesn't help you.</p></li> <li><p>Some ad-hoc scheme, like Base32 or Base36. This is really easy to implement if you know how Base64 is done (see above link). (Edit 3: I guess Base32 is actually <a href="http://en.wikipedia.org/wiki/Base32" rel="nofollow noreferrer">standardized</a>. Looks like RFC 4648 Base32 with <code>8</code> padding instead of <code>=</code> padding would work just fine for you).</p></li> <li><p>Some semi-standard approach. There are plenty of possibilities. Unfortunately, most of them rely on a couple of special non-alphanumeric characters, simply because by using as few as one or two more characters you can get far superior performance. Take a look at <a href="http://en.wikipedia.org/wiki/Binary-to-text_encoding" rel="nofollow noreferrer">Binary-to-text encoding</a> for a better survey than I can give.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload