Gossamer Forum
Home : Products : DBMan SQL : Discussion :

How to shorten URL

Quote Reply
How to shorten URL
I offten need such link as db.cgi?db=test&do=search_results&detail=1&ID=239 or longer. I would like to shorten it to: db.cgi?TID=239. It will be more convinent for both user and us.

I know I can use Apache rewrite rule. Or I can modify the DBman. Maybe I can finish it myself. But if an expert such as Alex give a hand. It will be more safe. Because I am not sure whether my modification is safe in mod_perl.
Quote Reply
Re: [cfox] How to shorten URL In reply to
Did you figured it out? Let me know if so.

I was able to shorten the URL to around 90 characters
(I am e-mailing this link, and dont want it to break)

I quess only way around is apache mod, but how?

Thx
Quote Reply
Re: [Suomi] How to shorten URL In reply to
Yes, I finished it.

You can modify the file admin/GT/CGI.pm

in sub load_data under the line # Load form data.

add following lines:

# mod at 2001/12/20 by cfox
# to create a short URL
if ($ENV{QUERY_STRING} =~ /^TID=(\d+)$/) {
$ENV{QUERY_STRING}="uid=default&db=training&do=search_results&detail=1&ID=$1&ID-opt==";
}


You can change as your need.

But be careful to use such shorten URL in admin or registered user area. For example, you logged into as a registered user, then you click a shorten URL, you will find you log out. I changed my templates to avoid such things.
Quote Reply
Re: [cfox] How to shorten URL In reply to
Thanks, I end up using html on my e-mail links... oh well :)
Quote Reply
Re: [cfox] How to shorten URL In reply to
If you don't have too many, an easy way I have found is using <a href=http://tinyclick.com?tinyclick>http://tinyclick.com</a> It's easy and free. Hope this helps! Cool