views:

216

answers:

3

Hi,

I use bit.ly to shorten my urls. My problem - paramters are not passed. Let me explain I use http://bit.ly/MYiPhoneApps which redirects (let's say) to http://iphone.pp-p.net/default.aspx Now when I try http://bit.ly/MYiPhoneApps?param=xx this param is not added to the resulting url. I know I could create an extra "short url" including a paramter - so http://bit.ly/WithParam would result in http://www.mysite.com/somepath/apage.aspx?Par1=yy and so forth.

But what I want is to have a short URL directing to a page - and then I want to add a parameter to this shortened url - which shoul (of course) land at my page.

Is this a shortcome of bit.ly (and others are maybe able to do it) - or does "parameter forwarding" not work with 301 redirections?

Manfred

+2  A: 

URL shortening associates a unique key based on a full URL (parameters and all), so it is not possible to pass parameters to a shortening service.

Typically

http://iphone.pp-p.net/default.aspx?param=10

must produce a different key to

http://iphone.pp-p.net/default.aspx?param=22

'Parameter forwarding' is simply not possible in these kinds of redirects, as parameters are not valid parts of a shortened URL is most (if not all) services.

David Johnson
Of course it's *possible*. OP's intention is not to have two target URLs map to exactly the same short URL - one key would still only map to one target. He just wants the service to manipulate the target using *additional* information provides as parameters. The two things are quite different.
Michael Madsen
Of course it's possible - if you're the service provider and build your service to allow that. But the OP talks about bit.ly specifically. And bit.ly nor any other current URL shortening service I know of does support parameter forwarding on short URLs.
David Johnson
+2  A: 

There's no technical reason why it couldn't be done. The service would simply have to look at what parameters it is being sent, and then rewrite the target URL accordingly.

The problem is that it's not necessarily well defined how to do that.

Suppose you have the url http://example.com/default.aspx?foo=bar, and it has the short url http://foo.com/ABCD. What should happen if you try to access http://foo.com/ABCD?foo=baz? Should it replace the value, so you get foo=baz? Should it append it to make foo=bar&foo=baz? If we include both, which order should they be in?

The system cannot know which parameters are safe to override and which are not, because sometimes, you DO want both of them in the URL, and it may matter what order things are added in.

You could argue "Well, just don't allow this for URLs where parameters are already present", but there's also the issue that it's going to complicate the process a lot more. Without this, you just lookup a key in a database and send a redirect header. Now, you need to also analyze the URL to check for parameters, and append part of the URL you were called by. That requires more system resources per redirect, which may become a big problem if your service is used very frequently - you'll need more server power to handle the same amount of redirects. I don't think that tradeoff is considered to be "worth it".

Michael Madsen
Matthew Flaschen
So it is technical (as I thought) possible - but some kind of a "logistic" or "how to handle" problem. If anyone knows a (stable) service whichs allows parameter adding please let me know.
ManniAT
A: 

Just a follow up - fortunately we have a 4 letter domain. Using url-redirect we solved the problem by providing our own short url like this: http://pp-p.com/p/ which is short enough I guess. And we can pass parameters like this http://pp-p.com/p/1 passing a "promotion ID" or http://pp-p.com/p/1/STOV for passing a promotion ID plus a refferer.

ManniAT