Mobile app version of vmapp.org
Login or Join
Karen161

: Custom short URLs I'm creating a WordPress site for a client and he mentioned that he would like his own custom URL shortening when sharing to Twitter. How do I go about setting up one of

@Karen161

Posted in: #Twitter #Url #Wordpress

I'm creating a WordPress site for a client and he mentioned that he would like his own custom URL shortening when sharing to Twitter.

How do I go about setting up one of these? If I had to guess, I would guess that it's a separate domain that redirects to the actual site. If that's the case, then how do I get the URL to redirect to the specific post and not just to the homepage of the site?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Karen161

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray432

You could try this recipe taken from the chapter on cloning TinuURL in the book Cloning Internet Applications with Ruby -


Make a hash of the long url(In this case, if it will be used to redirect to one domain, you could just make a hash of the relative url)
Convert it to base 36 - 26 alphabets and 10 digits.
Set up a 301 from short/base36(hash) to long domain.


And on the long domain, you can code a controller that sends a request to the short domain to create a short url every time a new page is created.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme