NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP And Search Engines

Chris Shiflett shiflett at php.net
Wed Sep 29 16:29:28 EDT 2004


--- Joseph Crawford <codebowl at gmail.com> wrote:
> what i need to know is if there is an easy way without use
> apache's mod_rewrite to make a search engine index pages that
> have querystrings such as
> 
> product.php?id=57 
> 
> where each id shows a dynamic page filled with information
> about different products.

I use ForceType, but mod_rewrite can work, too. My choice is based upon
the fact that I'm no Sklar or Schlossnagle when it comes to regular
expressions.

If I were you, I'd prefer to have URLs like this:

http://store.example.org/products/flying-car

Users don't care about your internal product IDs and such. Keep those to
yourself. :-)

The way you can have a URL like I use above is to make "products" a PHP
script. It doesn't need a file extension, because you can use ForceType to
tell Apache to treat it like a PHP file. The rest of the URL is available
to you in $_SERVER['PATH_INFO'], so you can use that to determine what
product the user wants.

Search engines apparently like this sort of approach, too. I do it,
because I like to have clean URLs.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
Coming December 2004        http://httphandbook.org/



More information about the talk mailing list