> One of the coolest things I have seen online, and some of you may not even
> know this works, but if you type in the url: "http://www.php.net/foo";
> you'll be taken straight to the foo page of the php manual, if one exists.
> If "foo" doesn't exist, you pull up a Google search-within-the-site page.
>
> I haven't been messing with php for very long, but I haven't been able to
> put together all of the pieces for something like this. Is it hugely
> complicated? There's definitely a lot more here than a simple .htaccess
> rewrite. Has anyone thought of any other uses this kind of thing could be
> put to?

It's a custom 404 page, IIRC. Your 404 page simply looks at the URL, grabs
the last part and forwards (using header(), I imagine) to the appropriate
page.

Many other uses for it, too. One that's written about on PHP.net is using
this to make static HTML pages. You have a URL such as domain.com/1234.html,
where that page doesn't exist. Your 404 page looks up product 1234 from the
database, writes an HTML page to disk called 1234.html, then redirects back
to the page. Now subsequent requests for 1234.html pull up the page just
created and do not hit the database at all. To "clear" everything, simply
delete all of the .html files and they'll be regenerated as they're needed.

I'm sure there are other uses...

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to