Gossamer Forum
Quote Reply
Short URL's
You can now use short url's in the forum if you need to reference the posts. Just look at the URL for Number=92866 where 92866 is the post number, then do:

http://gossamer-threads.com/p/92866

and it will take you to the proper place. Just a little fix as my email client was chopping the url in two. =)

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Very nice. How "little" a fix is it? I know someone who would likely be interested in that for an upcoming w3t installation, if you wouldn't mind sharing. Smile

Dan

Quote Reply
Re: Short URL's In reply to
Yes this is very interesting. Care to share how you did this Alex?

Quote Reply
Re: Short URL's In reply to
Well, I added this to apache's httpd.conf:

Code:
RewriteRule /p/(.+) http://gossamer-threads.com/perl/forum/showthreaded.pl?Number=$1&lookup=1 [R,L]
and then added into showthreaded.pl:

Code:
if ($FORM{lookup}) {
my $sth = $dbh->prepare ("SELECT B_Board FROM w3t_Posts where B_Number = ?");
$sth->execute($FORM{Number});
($FORM{Board}) = $sth->fetchrow_array;
}
The first part just transforms all URL's that look like:

/p/something

to:

/perl/forum/showthreaded.pl?Number=something&lookup=1

I had to add the second part as showthreaded.pl requires you to pass in the board name for some strange reason.

Hope that helps,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Thanks! I suppose one disadvantage is that defaults to threaded mode when you view a message in that format, although it looks like that could be changed in the full URL (I haven't installed W3T yet). Assuming it's an allowable change to Apache (shared environment), that should be fun to play with.

Dan

Quote Reply
Re: Short URL's In reply to
Hi,

Maybe someone could help me with this...I tried the code below to redirect

http://myserver.com/homepage/user

-to-

http://myserver.com/cgi-bin/dbman/db.cgi?db=default&ww=on&uid=default&view_records=1&Userid=$1

However, the URL gets redirected with "homepage/user" where all the "&"s are. The Userid=user part comes out right. Any ideas how I can get this to work? Thanks!

RewriteEngine on
RewriteRule homepage/(.+) http://myserver.com/cgi-bin/dbman/db.cgi?db=default&ww=on&uid=default&view_records=1&Userid=$1 [R,L]

Quote Reply
Re: Short URL's In reply to
What does the URL get redirected to? Can you paste a full example. What you have looks ok..

Cheers,

ALex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Hi Alex,

http://myserver.com/cgi-bin/profiles/db.cgi?db=defaulthomepage/userww=onhomepage/useruid=defaulthomepage/userview_records=1homepage/userUserid=user

so basically, it's replacing all "&"s with homepage/user. ThanksSmile!

Quote Reply
Re: Short URL's In reply to
Ah, try using \& instead of just & on the right side.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Man, I should have known that one! Thanks Alex Wink!

Quote Reply
Re: Short URL's In reply to
By the way, you can keep a nicer URL and make it load quicker by removing the R from [R,L]. The only reason I had to do the redirect as otherwise the cookies weren't sent to the program.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Wow, I was going to edit my last message to ask you another question, but you already replied to my post! Well, I was wondering how I could use ~user instead of the homepage/user. I tried RewriteRule ~(.+) URL and ^/~(.+) URL, but both of them redirect me to some different site (on my server, I presume). So I would want to type in http://myserver.com/~user to get the same URL we were talking about earlier. Thanks again!

Quote Reply
Re: Short URL's In reply to
Using ~ would be difficult, as normally /~ is handled by the user module which is mapped to that users home directory. So going to /~alex would go to /home/alex/public_html.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Hello Alex!

Vow, damn good thing!!! Can one integrate in to Links.pm and make a part of the main script? Like category directory path short forms?

Quote Reply
Re: Short URL's In reply to
I'm not sure if this is stricly a problem related to the short URL, but I just got a reply notification:

Alex replied to your post. You can view it on the forum at:

http://gossamer-threads.com/p/95824

(I got another reply notification from Alex for a different post number 9 minutes earlier.)

When I click on the link, I get the following error page:

We cannot proceed.

We cannot complete your request. The reason reported was:

Access Denied.


The other one I was just sent works fine. Could the error be due to a deleted message possibly? I don't know what thread the reply was in to look for it...

Dan

Quote Reply
Re: Short URL's In reply to
Yes, that's a deleted message. I had double posted and deleted it. =)

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
Ok, disregard then... Is there any way to make a deleted post number forward to the thread it originally was in? That might remove the occasional point of confusion.

Dan

Quote Reply
Re: Short URL's - ?ubb=000636:Form12 In reply to
I like the shorten urls Smile .. thanks

Someone tried following this thread reference:

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000636.html

Where the forum script directs to is:

http://gossamer-threads.com/perl/forum/showflat.pl?ubb=000636:Form12

which comes up with "We can not Proceed" error.

It works by typing in:

http://gossamer-threads.com/perl/forum/showflat.pl?ubb=000636:Forum12

Instead of going to "Forum12" it's going to "Form12"

Alex could you check to see if this is just a minor typo in the forum script Smile

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Short URL's - ?ubb=000636:Form12 In reply to
Oops, this is indeed a typo. It should be resolved now.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Short URL's In reply to
How to do this with dbman, to shorten the url of each record.

Regards,
Act.
I am new to cgi, Thank you for your help.
Quote Reply
Re: Short URL's In reply to
This was not done by cgi or perl, but by configuring apache to rewrite URL's. It will only work on a dedicated server (reliably).

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://LinkSQL.com/FAQ


Quote Reply
Re: Short URL's In reply to
Is the ReWrite rule just like an alias or is it a real path?

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Short URL's In reply to
The ReWrite engine takes a URI as input, and does exactly what it says -- rewrites it before acting on it.

For instance, here is how I have the /faq working:

RewriteRule /faq http://LinkSQL.com/cgi-bin/FAQ/page.cgi [R,L,NC]


Here's how I shortened my postcards pickup string:


RewriteRule /pickup/(.+) http://postcards.com/cgi-bin/LinkSQL/postcards.cgi?Do=pickup&PickUpCode=$1 [R,L]

That turns http://postcards.com/pickup/adlkfjasdlkfjasd

into

http://postcards.com/cgi-bin/LinkSQL/postcards.cgi?Do=pickup&PickUpCode=adlkfjasdlkfjasd


There are some good starter pages on using it at Apache.org. Alex helped me get some of it straight, it's not all common sense.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://LinkSQL.com/FAQ


Quote Reply
Re: Short URL's In reply to
Cool....

In Reply To:
That turns http://postcards.com/pickup/adlkfjasdlkfjasd

into

http://postcards.com/cgi-bin/LinkSQL/postcards.cgi?Do=pickup&PickUpCode=adlkfjasdlkfjasd
Shouldnt it be the other way round?

That turns http://postcards.com/cgi-bin/LinkSQL/postcards.cgi?Do=pickup&PickUpCode=adlkfjasdlkfjasd

into

http://postcards.com/pickup/adlkfjasdlkfjasd

What does (.+) do by the way?......





Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Short URL's In reply to
I successed,by add these two lines in config file.

RewriteEngine on
RewriteRule /homepage/(.+) http://myserver.com/cgi-bin/dbman/db.cgi?db=default\&ww=on\&uid=default\&view_records=1\&Userid=$1 [L]



Regards,
Act.
I am new to cgi, Thank you for your help.