By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

php extensions

P: n/a
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=...=Google+Search

is search a php script?

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?

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

Thanks,
Jon
May 2 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jon Slaughter:
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?
You should have looked into that _before_ publishing URLs.
That is, is there something bad about using the php exention?
URL "extensions" in general are worse than useless.
(or maybe it can be turned off or something similar?)
Look into mod_rewrite or MultiViews.

--
Jock

May 2 '07 #2

P: n/a
On Wed, 02 May 2007 02:53:02 -0500, 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=...=Google+Search

is search a php script?
IIRC, Google use their own C/C++ based extensions.
Sh
May 2 '07 #3

P: n/a
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=...=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
May 2 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.