Gossamer Forum
Home : Products : Links 2.0 : Discussions :

SE-friendly URLs

Quote Reply
SE-friendly URLs
Hi,

How can I replace these URLs, example:
http://www.mydomain.com/cgi-bin/buscador/rate.cgi?ID=10942

for SE-friendly URLs:
http://www.mydomain.com/cgi-bin/buscador/link_title

Thanks
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Read here: http://www.gossamer-threads.com/...?post=270259#p270259
Note that this will make the link be a direct link, that is, not use the jump.cgi, which means you no longer track ho wmany hits each links.

There is a more extensive mods to do what you want: http://www.gossamer-threads.com/...?post=296762#p296762


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] SE-friendly URLs In reply to
Hi Leonard, thanks for your reply.
First, sorry for my english, I am spanish.

I want replace ONLY the URLs with 'rate.cgi?ID=xxxxx' for
the title of that corresponding link. NO interested in jump.cgi and others.

Example:
http://www.mydomain.com/cgi-bin/buscador/rate.cgi?ID=12143
for...
http://www.mydomain.com/cgi-bin/buscador/Free-Internet-Access
(where 'Free Internet Access' is the title of the link ID 12143)

Is there an easy method to make this? mod_rewrite maybe? How?
I will pay $10 (paypal) for the first post with a simple solution (it must works ;)

Thank you
Vicent
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Hi,

You could use mod_rewrite.

1) Add a .htaccess file to your links folder (i.e /www/links/) Put the following code in it:

Code:
RewriteEngine On

RewriteRule ^jump/([0-9]+).html$ /cgi-bin/links/jump.cgi?ID=$1 [L]

This should then make the URL format:

http://www.yourdomain.com/links/jump/123.html ... goto http://www.yourdomain.com/cgi-bin/links/jump.cgi?ID=123

2) Assuming that works, then you just need to change your link.html template, so that it uses:

Code:
<a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>

Code:
<a class="link" href="<%build_root_url%>/jump/<%ID%>.html"><%Title%></a>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Aug 28, 2007, 12:58 AM
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
Hi,

Thanks for your reply too, but your mod_rewrite is for jump.cgi
and I want to change 'rate.cgi?ID=xxx' to 'Link-Title' as I
explained in my previous post.

Vicent
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Hi,

Ah ok,well - the simple answer - is you can't do that =)

You would have to use something like:

rate_123.html

..which would goto rate.cgi?ID=123

Using the title of a link isn't unique, so you can't get the URL that the record needs to go to.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
And

title_123 or title_123.html?
That will be SE friendly equally.

Is it possible?
I am really wishing pay you $10 :)

Thanks
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Hi,

You could do:

..change:
Code:
<a class="link" href="<%db_cgi_url%>/rate.cgi?ID=<%ID%>"><%Title%></a>

..to:

Code:
<a class="link" href="<%build_static_url%>/rate/<%Title%>_L<%ID%>"><%Title%></a>

...and then this in your .htaccess file;

Code:
RewriteEngine On

RewriteRule ^rate/(.*)([0-9]+)$ /cgi-bin/links/rate.cgi?ID=$1 [L]

The problem you may encounter, is un-standard formatted charachters (i.e space, @ & etc). It should still work - but the charachters will not show up as they were originally intended to (i.e yoursite.com/rate/Some Time Test_L1234.html , would actually show as something different, i.e yoursite.com/rate/Some%20Time%20Test_L1234.html)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
Hi,

I tried it and get an error:

Unkown%20Tag:%20build_static_url
For example:
http://www.logratis.com/directorio/Anuncios/Unkown%20Tag:%20build_static_url/rate/Cambalache_L10013

but mod_rewrite to 'title_Lxxx' works.

This is my site...
www.logratis.com

You can check it.
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Hi,

Oops, got the tag wrong =)

Try changing:

Code:
<a class="link" href="<%build_static_url%>/rate/<%Title%>_L<%ID%>"><%Title%></a>

..to:

Code:
<a class="link" href="<%build_root_url%>/rate/<%Title%>_L<%ID%>"><%Title%></a>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
Now all the links go to the same page...

http://www.logratis.com/directorio/Ratings/
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Hi,.

Mmm.. can you send over FTP access, so I can take a look? The URL (http://www.logratis.com/directorio/rate/Agencia%20de%20Contrataci%F3n%20de%20Artistas_L13105) format looks ok - so it should be going to the correct place).

Could be a mod_rewrite issue - but is hard to work out exactly what without tweaking it.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
Hi,

Actually - try this:
Code:
RewriteEngine On

RewriteRule ^rate/(.*)_L([0-9]+)$ /cgi-bin/links/rate.cgi?ID=$1 [L]

..and see if that helps :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
Hi,

I sent to you an email.

Last edited by:

vicent: Aug 29, 2007, 6:21 AM
Quote Reply
Re: [vicent] SE-friendly URLs In reply to
Hi,

Should be sorted :)

http://www.logratis.com/...de%20Artistas_L13105

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] SE-friendly URLs In reply to
It works very well now :)

Many thanks for All your help

Regards
Vicent