You are here: Re: php extensions « PHP Programming Language « IT news, forums, messages
Re: php extensions

Posted by Toby A Inkster on 05/02/07 09:43

Jon Slaughter wrote:

> In most sites that, I guess, use php I don't see them use the php extension.
>
> For example,
> http://www.google.com/search?source=ig&hl=en&q=php+query+string&btnG=Google+Search
> is search a php script?

No -- Google primarily use C for their search. Some of the newer and less
data-intensive stuff is written in Python and Java.

Yahoo, on the other hand, use PHP almost exclusively.

> Right now I have things like file.php?something
> and I was wondering if that is ok or if I should look into changing it to
> file?something?

Or better yet:

file/something/

> That is, is there something bad about using the php exention? (or maybe
> it can be turned off or something similar?)

Firstly, there is the slight security issue. Occasionally, security issues
are discovered in PHP. If your site includes ".php" in URLs, then it's
blindingly obvious that you're using PHP, so you become a potential target
for attack. This generally isn't a huge issue if you keep your copy of PHP
up to date though.

More importantly though is the issue of "cool urls". You should start by
reading Sir Tim Berners-Lee's essay "Cool URLs Don't Change" (you ought to
be able to find it on Google).

In particular, a few points:

1. What if, in 6 months time, you change to using Python? Do
you want to change all your URLs to ".py", breaking incoming
links?

2. Do visitors care that you're using PHP? If not, why should
they have to write ".php" when they're typing up one of your
URLs, or speak it if they're reading it over the phone? Keep
URLs short, and keep unneeded information (such as which
scripting language you used) out of the URL.

The general tools you can use to ensure nice URLs are Apache's mod_rewrite
module, Apache's MultiViews option and PHP's $_SERVER['PATH_INFO']
variable.

The mindset you have to get into is: the URLs on my website don't have to
bear *any* relation to the filenames I use on my server.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

 

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

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