I'm building an internal URL shortening website for my company. Since so few people will use it, we're letting people choose their own custom shortened URLs. So, for example, you could have the shortened URL:
We thought it would be cool to offer, in addition to a regular redirect, the ability to leave the shortened URL in the address bar. One way to do this is with frames:
<frameset rows="100%,*" border="0"> <frame src="http://some_really_long_url" frameborder="0" /> <frame frameborder="0" noresize /> </frameset>
But this solution breaks links on the destination site (clicking one won't update the address bar).
What's the best way to accomplish this?
You could write a pass through script that reads the destination url, and passes the contents back. I doubt it would be robust though. I doubt any solution to this would be robust. What is the purpose of this? And what's wrong with the frame?
Why not just do a server side include of the appropriate file/content instead of the redirect?
In order to preserve the original destination of relative links within the page, you could use the base tag.
<html> <head> ... <base href="/original/really/long/url/" /> ... </head> <body> ... <a href="relative-url.html">a happy relative link</a> ... </body> </html>