I found some websites which use urls like this:

http://www.site.com/order/product2/discount
The params for the file order are product2 and discount

I wonder how they do this because i am currently only familiar with the ?param1=value & param2=value method..

    i don't know, i would be interested in this also...

    you do know that $_SERVER['QUERY_STRING'] exists, so you can write your own parser for forms different than blah=blah&blah=blah

    my theories :

    1) only one script approach... (virutal directories).... perhaps these sites only have one file, index.php. that file gets passed the whole string, so

    http://www.site.com/order/product2/discount

    really means :

    http://www.sire.com/index.php?order/product2/discount

    now this query string gets hand parsed on '/', the results of this explode() are interpretted as either virtual directories or parameters depending on what you want to do

    2) tell apache to run all files (extensionless) as php scripts.... then create a directory based site, where your only actionable scripts are index.php and each one takes the rest of the query string and hand parses it

    the trick is how to get apache to figure out the difference between the script and the query string in your uri without place a file extension onto it.

    Zope does something similar to this btw, however it is not just some scripts behind apache, it is it's own standalone server.

      I was thinking mod.rewrite or speling. [sp]

      Both will accomplish the same thing in apache.

      They could have their 404 page redirecting as well.

        Write a Reply...