0

I want to create something similar to "youtube.com/long => youtu.be/short" for my wordpress blog/portfolio/freebie site: "magicshrooms.com/%cat-etc => mgcsr.mz/link-name ". Generally, I want to create a short link for each link and also for downloads, since my url is quite long. Of course I will buy short domain and what to do further i am lost...

Tried googling it and apparently its more complex than I thought. There are services like bitly, but ridiculously expensive. Also something called YOURLS, but no clue how it works.

Is there anyone who has this function implemented and could point me to tutorial or simply explain how to do this.

Also, guys what do you think about this url shortening? Good/bad idea?

Thanks in advance:)

  • You could just set up a redirection in your htaccess. – Tomás Cot Aug 22 '14 at 17:33
0

Here's a possibly simple solution, using an ancillary table, and user-defined short slugs:

create a post_meta "short_slug" when creating a post, the link-name from your example

on save_post, if (meta_key='short_slug' and is_a_valid(meta_value)) wpdb->insert into short_slugs_table slug,permalink ,

your index.php on your mgscr.com could then open a mysql connection to the same db, parse the url and do a Location:redirect.

  • Okey, seems like not much to do, but i guess half of the terms you have used I do not understand. I guess i need tutorial :) – nerijusgood Aug 22 '14 at 17:50
  • maybe it'll work! step 1: acquire new domain. step 2: test new domain to make sure it can connect to your wp database using PHP mysql functions. step 3: create new table in wordpress db ... etc. good luck – user373396 Aug 22 '14 at 18:20
0

I wrote an article a while ago on how to do this using Bit.ly and a custom url.

http://craigmdennis.com/articles/set-up-a-custom-short-url-with-wordpress

  1. Buy a short URL
  2. Sign up for bit.ly
  3. Add an A Record to point to bit.ly and verify it
  4. Download & install bit.ly Service WordPress plugin
  5. Use <?php echo wp_get_shortlink(); ?> in your theme

As for the merits or it, the jury's still out. It obfuscates the URL so users are less likely to trust is as they can't predictably know where they're going. It does make URLS easier to read / remember and if the short domain is associated with the longer one (youtube.com -> youtu.be etc.) then you should be fine.

  • Ye it would be associated. An basically my long url will take up lots of space uri/%cat%/%post-name%/. Mainly so I could use this in twitter and other limited areas. How good/bad for SEO this? Is bitly good for seo or something local would be better? – nerijusgood Aug 22 '14 at 20:02
  • According to Google, all well behaved short URL tools use 301 redirects to point to the final content. So the PageRank is passed to the final destination page like any other 301 redirect. youtube.com/watch?v=QMkltd6dZzU – Craig Aug 22 '14 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.