Re: strange php url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all and thanks for the answers.

On my server, the building of some webpages with url like the one below produces a loop and crashes the server. (http://myurl.mydomain/path/index.php/path/index.php).

As I never heard about the PATH_INFO before, I'm not sure the site uses this value.
(I'll check the code to be sure).

If I can make sure the PATH_INFO isn't used anywhere in the code, is there a way to change the config in order to generate a 404 for each url with a not null PATH_INFO ?

Nicolas Figaro

Joe Wollard a écrit :
I believe Kevin is on the right track there. To expand a bit, you can use
$_SERVER['PATH_INFO'] with these urls instead of $_GET to make use of the
data it contains

example for url http://www.example.com/index.php/foo/bar
<?php
echo $_SERVER['PATH_INFO'];
?>

produces:
/foo/bar

You can then parse this string, (generally by using the '/' character as a
deliminator) and extract the data. MediaWiki even provides information
(can't think of where at the moment) on how to use Apache's mod_rewrite to
hide index.php thus making the url even cleaner:
http://www.example.com/foo/bar

Cheers!
- Joe

On 4/21/06, Kevin Kinsey <kdk@xxxxxxxxxx> wrote:
Hi,

could anyone tell me why the following url doesn't
generate a "page not found" ?
http://www.php.net/manual/en/function.checkdnsrr.php/manual/

you can try with a longer url after the last .php.

I tried with ../manual instead of manual and this produces a 404.

I checked with www.php.net because my own site does the same and I
wanted to be sure it didn't come from my config.

thanks

Nicolas Figaro
tg-php@xxxxxxxxxxxxxxxxxxxxxx wrote:

The other thing that could happen is they could be
using something like the Apache mod_rewrite (some
info at http://www.modrewrite.com/ among others) which
can dynamically change the requested URL to a more
standard URL before sending back to the user.

Something like this:
http://www.testserver.com/tgryffyn/homepage/middlesection

Could be turned into something like:

http://www.testserver.com/userpage.php?user=tgryffyn&page=home#middleanchor
But to the user requesting the page, it'll always look like the first
URL.
Forgive me if I got any syntax or capability of mod_rewrite wrong,
never used it myself just know that's the general sort of thing that it
does.
Pretty good thoughts, there.  Some years ago, Tim Perdue
(of PHPBuilder and SourceForge fame) had a popular
article on "Search Engine Friendly URL's" (or some such),
in which he described use of the Apache ForceLocal
directive to make a site just One Big Script, parsing
the slashed portions of the query string as variables
(instead of GET, a la "?section=man&term=foo") so that
the browser appears to be accessing documents in subfolders,
but it's really just telling the server to grab a page with certain
values defined in the URI.

It sure looks like a possibility of this or similar magic in
this case.  Of course, I could be way off my tree...

Kevin Kinsey

--
Byte your tongue.

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




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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux