Topic-icon Old (very old) UShorten links conversion

Active Subscriptions:

None
For a number of years, I have used UShorten (version 1.0) to create shortlinks on the current Joomla! 1.5.26 site.
This has worked fine. Shortlinks are still 'out on the internet'.
We are working on a migration to Joomla! 2.5
All of the old shortlinks that have been sent out into the internet and have been used internally in articles will get lost when these links are no longer resolved in the new Joomla! version.
Is there any way to resolve this problem?
We really would like to make sure that all of those old shortlinks remain working.
The topic has been locked.
Support Specialist
11 years 1 month ago #31273 by alzander
Roland,
Wow, a blast from the past :) It's been a while since we heard about UShorten. I'm glad to hear it's worked well for you after all this time.

Unfortunately, as you can probably already guess, we aren't upgrading that extension to Joomla 2.5+ However, I think with a simple MySQL query, you can export your current short URLs and add them to your .htaccess file to recreate the same redirections. It will take a little work and testing, but should be possible.

So, open up a MySQL query tool, like PHPMyAdmin. Then, run the following command:
SELECT CONCAT('RewriteRule ^', short_url, '$ http://YOURDOMAIN.com/', long_url, ' [R=301,nc,L]') INTO OUTFILE redirects.txt FROM jos_ushorten_short_link
MySQL doesn't always allow the INTO OUTFILE, depending on your permissions. So, you may need to change that query, but hopefully, that gets you started.

The output will be clean statements you can just throw into your .htaccess file anywhere after the RewriteEngine On statement. They'll look like:

RewriteRule ^a8X$ YOURDOMAIN.com/long-url.html [R=301,nc,L]


Hopefully, that all makes sense and/or you have a developer you can hand these instructions off too. It shouldn't be too bad... hopefully.

Thanks, and good luck,
Alex
The topic has been locked.
Active Subscriptions:

None
Thanks for the reply! I didn't really expect that there would be a new component. However, the export is something I will look into. I'll first find out if a table of some 28.000 entries can be handled by the apache server in htaccess
It might slow down the server a bit.
Anyhow, thanks for the reply and I'll find some solution.
Roland
The topic has been locked.
Support Specialist
11 years 1 month ago #31280 by alzander
Roland,
You can actually do thousands of redirects in .htaccess. Apache can slice through that file like sliced butter. That's not to say there won't be any speed hit, but my guess is that it will be pretty small (under .25s). So, yes, a 'hit', but that's something you can weigh the benefits of.

One other option is to update that query above to only pull down the short URLs with >100 (or 1000) hits, for example. That way, some users may get 404's, but the important pages will have redirects.

Hope that helps, and keep us posted on what you find. Curious to hear how it goes,
Alex
The topic has been locked.