Forum Moderators: coopster

Message Too Old, No Replies

Shortening links

such as .php?articleID=9705&PHPSESSID=6dfcbcac513fa64323e7d4e4b052d6a5

         

henry0

7:35 pm on Apr 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a bunch of older scripts that are not causing any troubles.
but I would like changing the way links are displayed to a more updated fashion

is it possible
how much work is involved

Thanks

HEnry

andylarks

12:59 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



Is there any particular reason why you are using $_GET, and couldn't swap it for $_POST so you don't need the stuff after .php?...

?

Just a thought.

Also, why do you need to pass the session id? Could you not register the session variable, and pass that through?

Andy

barn_de

2:05 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



Hi,

i wouldn't recommend to use post. you would have to put a form in the page and also make every link a submit button.

so first about the phpsession id. i would use session cookies for this. so your url already would have no session id anymore.

second i would try to get apache mod rewrite. so you can rewrite your url to something like this:

domain.com/article/123456

then you have to define a rewrite rule in apache wich changes the url for internal use to domain.com/article.php?articleid=123456. so there're no bigger changes to do to your script then.

hope this helps.

barn

Torsion

4:50 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



What exactly are you trying to achieve? To help you, you must be more specific, like "I want to shorten the link"

jatar_k

11:37 pm on Apr 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what about using mod_rewrite henry0?

rewrite them to something like

/article/9705.htm

henry0

12:21 pm on Apr 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you
I apologize for not being around and replying to your posts
Yesterday was a long all day meeting!

I will among other suggestions follow Jatar_K and Barn_de
idea in using mod_rewrite

Henry

WhosAWhata

11:21 pm on Apr 3, 2004 (gmt 0)

10+ Year Member



RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R,L]
RewriteCond %{REQUEST_URI} ^article/
RewriteRule article/(.*).html$ index.php?articleID=$1 [L]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) index.php [L]

this should be close to what you need

henry0

11:33 pm on Apr 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WhosAWhata,
thanks
every other day I kick myself for not digging enough in rewrite
for some reasons it does not look fun to me :)

WhosAWhata

12:19 am on Apr 4, 2004 (gmt 0)

10+ Year Member



i know exactly what you mean, that is just a slight modification of code that i and about 10 others including ppl on this forum wrote about a week ago