Re: strange php url

From: Date: Tue, 25 Apr 2006 05:52:13 +0000
Subject: Re: strange php url
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-234655@lists.php.net to get a copy of this message
On Mon, April 24, 2006 1:58 am, nicolas figaro wrote: > 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). Odds are VERY GOOD that you have some kind of bad regex in your httpd.conf which sends Apache into an infinite loop in mod_rewrite. You will need to turn on mod_rewrite debugging and error logging and crash the server again to find out what is happening. > 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). [james stewart voice on] One of the advantages of using $_SERVER['PATH_INFO'] in PHP instead of mod_rewrite is that it's a lot harder to screw things up so spectacularly. [james stewart voice off] > 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 ? I don't really understand this bit, but you should be able to do something like this: <?php if (is_bad($_SERVER['PATH_INFO'])){ header("Location: http://example.com/nonexistent.htm"); } ?> This assumes that you can discern "bad" PATH_INFO from "good" PATH_INFO and that nonexistent.htm does not actually exist -- or that could exist and be a pretty page explaining that the URL they want isn't there, if you don't want a true 404 -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#234655) next »