NYCPHP Meetup

NYPHP.org

Making URLs Search Engine Friendly - Follow Up

ophir prusak prutwo at onebox.com
Thu May 23 10:43:40 EDT 2002


Hi All,

I wanted to go over a few items as a follow up to my presentation last
night (ok - I forgot to look at my notes :)

1. I don't know how I forgot to mention this, but one of the biggest
disadvantages of the PATH_INFO method is that it does not work with cgi
versions of PHP.
As in the nature of yesterday's presentation - does anyone know what
error you get and why it doesn't work with cgi versions of PHP ?

2. When making your URLs search engine friendly, there is an advantage
of using URLs that looks like an .html file (and not just a path, as
often done with the PATH_INFO method).
In the future, if you should want to make any of your pages truly static,
it makes life easier.
For example, one of the pages on my web site was getting a lot of traffic,
so instead of having it be created on the fly, I simply created a crontab
entry that once a day grabbed the dynamic page and saved it to a static
page. Something like this:
wget http://www.mysite.com/dynamic-version.php -o static-version.html

Just a side note - I no longer do it this way, but instead use a output
caching object to get almost the same performance gain.

3. Someone asked how do I make ANY file in a directory be treated like
a PHP file, regardless of filename (under apache of course). Add this
line in your .htaccess file for the directory you want to use:

ForceType application/x-httpd-php   (or whatever mime type you use for
php)

For more details see http://httpd.apache.org/docs/mod/mod_mime.html#forcetype

I've created an example at:
http://www.consolemonkey.com/nyphp/allphpfiles/example/name/ophir/city/nyc.html
(I'll leave it up to the reader to write the regex to remove the .html
from the PATH_INFO so your last value won't have .html appended to it
;)

Hope you all learned something.

Ophir

----
Ophir Prusak
Internet developer 
prutwo at onebox.com | http://www.prusak.com/ 

 



More information about the talk mailing list