Forum Moderators: phranque
I have been told to change from the form
www.widget.com/cgi-bin/script.pl?cart_id=whatever&page=whateverelse to the form
www.widget.com/cgi-bin/script/cart_id/whatever/page/whateverelse
like amazon.com does and use the PATH_INFO to break out the variables using / delimiter.
This make sense except for one thing:
How does server now to execute the script rather than search for the subdirectory whateverelse as all the dilimeters are / and the? is gone.
In all the examples of using path info to create nice URLs, the links are in this format:
www.site.com/index.php/cPath/7_63
The URL actually points to a script with an extension and then the vars are added after that. I don't particularly like that method, but it does seem to work.
My preferred method is to use Apache mod_rewrite to silently redirect the request. This way you don't even need to parse the path info in the script. Mod_rewrite puts the vars in the querystring and then you can access them the 'normal' way.
Check the Apache forum for ALOT of examples.
Regards,
Birdman
So what you are saying is the URI is parsed from left to right, and once it encounters the script name, it will immediatly execute the script, and it will pull the remainder of the URI (the fake directory look alike) into the variables in my script (by using QUERY_STRING and PATH_INFO and a bit of string manipulation).
Cool
I even tried using the simple hello.pl script and
www.widget.com/cgi-bin/hello.pl/cartid/cart_no/pageid/pageno
brings up page not found (as it is treating this like a directory path instead of passing the data after hello.pl to the script.
To get the hello script to work I need to put the? after hello.pl, and im trying to avoid the special characters to make the site spider friendly.
Will this work in Appache and not in IIS. Have anybody tried this on IIS
Since im on IIS and my ISP is unwilling to install a third party mod_rewrite script, im stuck.