You are here: Re: Redirecting URL ID's using PHP « All PHP « IT news, forums, messages
Re: Redirecting URL ID's using PHP

Posted by Rik on 06/16/07 13:45

On Sat, 16 Jun 2007 13:35:23 +0200, Sebastiaan 'CrashandDie' Lauwers =

<crashanddie+usenet@gmail.com> wrote:

> Armand Brahaj wrote:
>
>> You can do it with headers.
>> if ($_GET["p"]=3D=3D12)
>> {
>> header("Location: http://www.domain12.com/");
>> exit;
>> }
>
> So basically, you have a delivery guy transporting a very heavy closet=
....
>
> He has this address: www.example.com/?p=3D12
>
> So he goes up the stairs, he has to do 3 floors worth of stairs (of =

> course the elevator is broken), with his closet, and works his ass up =
to =

> the bone in order to get there, he knocks on the door, and yells "I ha=
ve =

> a delivery for www.exampl.." and before he even finishes the sentence,=
=

> someone answers: "No I'm sorry, you have the wrong address, it's 2 =

> floors lower, second door on the left"...
>
> Kind of ridicule, don't you think ?

Nope, it isn't. Whatsmore: it's blindingly fast, and the delivery guy wi=
ll =

now know where to deliver it's packages in future. What's ridicule is to=
=

accept the package and deliver it to your moved neighbour yourself until=
l =

the end of time, again and again and again.

> So why, oh why, instead of playing ping pong with header requests, don=
't =

> you guys learn to properly use redirects ?
>
> header ("Location:") is waaay overrated, just include the correct file=
, =

> and you'll be fine, and if you're not, you coded the website like an =

> idiot...

On a small site, fine (keep in mind the penalties from search engines fo=
r =

duplicate content though). A correct approach, especially for bigger =

sites, would be a MOVED PERMANENTLY redirect though: no duplicate conten=
t, =

legacy code, problems with relative resources etc. For logging hits it =

would also be preferable, and what's more: search engines recognize =

permanent redirects for what they are (well, at least Google does last =

time I checked), so you don't have to earn your position for the new url=
=

all over again.

If possibly, I'd opt for the webserver itself to handle this instead of =
=

PHP though, preferably in the configuration, if not possible at least in=
a =

..htaccess file.

To state 'just include the correct file...(if you're not fine) you coded=
=

the website like an idiot..' is clearly ignorant on so many levels it =

doesn't dignify an answer.
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация