NYCPHP Meetup

[nycphp-talk] Friendly URLS... The easy way!

Marc Antony Vose suzerain at suzerain.com
Mon Aug 6 23:47:01 EDT 2007


Hi there:

I've noticed a lot of web sites using this technique.  I know this  
stuff always changes, but one potential caveat:  the last I knew,  
search engines were either ignoring or ranking down anything after  
the xxxx.php in the URL when people use this structure.

Meaning, essentially,

http://www.something.com/script.php/some/other/thing

is not as good as

http://www.something.com/script/some/other/thing

from Google's point of view.

So, easier, yes, but it might give you some unwanted side effects.   
Again, this information might have changed, or even might have been  
wrong in the first place, but since mod_rewrite is so dead simple to  
use, IMO it's not worth the risk.

Maybe someone else can either clarify or refute my claim.

Cheers,

Marc
http://www.suzerain.com



Le 7 août 07 à 09:19, Paul Houle a écrit :

> There's an easy way to get 'friendly' URLs in PHP.  There are two  
> tricks involved:
>
> (1) It seems to be a bit obscure that if you have a PHP script at
>
> http://somewhere.com/myscript.php
>
> the same script is called if you visit
>
> http://somewhere.com/myscript.php/some/subdirectories.gif
> http://somewhere.com/myscript.php/article/2007/07/07/hello-world
>
> Try it!  You can make your script display something different based  
> on the path
> you enter by checking the superglobal $_SERVER["PATH_INFO"].  From  
> simple
> if-then-else ladders to advanced frameworks,  you can take it from  
> there as you wish.
>
> (2) You can remove the ".php" from your scripts by putting the  
> following in your
> .htaccess or apache configuration:
>
> DefaultType application/x-httpd-php
>
> Now if you have a script without an extension (say,  "myscript")  
> you can write
>
> http://somewhere.com/myscript/some/subdirectories.gif
> http://somewhere.com/myscript/article/2007/07/07/hello-world
>
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list