How to make PHP pages search engine friendly
Peter Murray
Peter.Murray at uconn.edu
Sun Aug 15 15:44:20 EDT 2004
Thomas Dowling wrote:
>David Moore wrote:
>
>
>>I have found a few web pages that explain how to do this using
>>$path_info, etc., but I'm not having much luck with it. I have PHP loaded on
>>a Windows 2000 server.
>>
>>
>Instead of "...script.php?var1=Alice&var2=Bob&var3=Carol" you'd have
>"...script.php/Alice/Bob/Carol" and split the $_SERVER[PATH_INFO]
>environment variable on the "/" character. You may have more sensible
>results if you strip off the leading slash first:
>
> $foo = ereg_replace("^/", "", $_SERVER[PATH_INFO]);
> list ($var1, $var2, $var3) = explode("/", $foo);
>
>
I'm a big fan of doing this, and I think it should be done more often
for the benefit of our users -- in Thomas' example, the latter is more
more easy to transcribe, remember, or publish than the former. Not only
are the pages more search engine friendly, but other benefit are that
you can give predictable URLs for others to use and make an entire
section of your website appear to be static when it is really
dynamically generated. I made great use of this at my previous
employer. All of the content of these URLs and subsequent links are
dynamically generated (even the results of the search, as in the last
example):
http://www.law.uconn.edu/library/database/
http://www.law.uconn.edu/courses/
Peter
More information about the Web4lib
mailing list