PDA

View Full Version : Apache/PHP: URL that has directory structure but runs script with parameters


me3ohm
January 19th, 2006, 07:30 PM
Hi,

I have seen a PHP script that uses a directory structure in the URL but actually runs a script and then passes the rest of the directory script as variables.

I can't remember how it was done and I really want to use this feature!

for example:

http://example.com/new/phone/BT would run new.php and pass phone and BT into the POST variable.

Any ideas?

Thanks

Matthew

john_spiral
January 19th, 2006, 08:07 PM
Hi,

there might be a beter way of doing this, but here is my 2 cents:

have a look at the below page:

http://uk2.php.net/basename

looks like the the basename function might be able to do it's magic.

sapo
January 20th, 2006, 05:52 AM
This isnt php, its the apache mod rewrite, just google it :)

me3ohm
January 27th, 2006, 03:05 PM
Thanks very much for all your help :-D