Page 1 of 1

Question about page.php/wordgoeshere

Posted: Tue Nov 09, 2004 3:25 am
by Mr Tech
Hey there,

I've seen pages that have a URL like: http://www.devpapers.com/view_author.php/39

See how they have a /39 after the file name? I'm presuming that ti works the same way as: http://www.devpapers.com/view_author.php?39

How do I get the PHP to read the text after the /?

Thanks

Posted: Tue Nov 09, 2004 4:08 am
by timvw
you can use apache mod_rewrite for that

Posted: Tue Nov 09, 2004 4:10 am
by kettle_drum
Google for mod_rewrite.

Posted: Tue Nov 09, 2004 7:27 am
by Weirdan
[google]path_info[/google]

You can emulate path_info feature via mod_rewrite, but generally there's no need to.

Posted: Tue Nov 09, 2004 1:17 pm
by rehfeld

Code: Select all

// given the url  http://www.devpapers.com/view_author.php/39/foo/bar

echo getenv('PATH_INFO'); // outputs: /39/foo/bar

the reason thr url still works is because apache will keep seeking for existing filenames in the given url,
first it checks for a file named "bar"
if not found, then it seeks for "foo"
then if not found, it looks for "39"
then, if not found, it looks for "view_author.php" , which it finds. so the PATH_INFO envionment variable will be set based upon the currently executing script

Posted: Tue Nov 09, 2004 4:57 pm
by Mr Tech
Thanks rehfeld,

That helped a lto :)