note 78597 added to function.preg-replace

From: Date: Thu, 18 Oct 2007 15:49:51 +0000
Subject: note 78597 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-131509@lists.php.net to get a copy of this message
Hi. Not sure if this will be a great help to anyone out there, but thought i'd post just in case. I was having an Issue with a project that relied on $_SERVER['REQUEST_URI']. Obviously this wasn't working on IIS. (i am using mod_rewrite in apache to call up pages from a database and IIS doesn't set REQUEST_URI). So i knocked up this simple little preg_replace to use the query string set by IIS when redirecting to a PHP error page. <? //My little IIS hack :) if(!isset($_SERVER['REQUEST_URI'])){ $_SERVER['REQUEST_URI'] = preg_replace( '/404;([a-zA-Z]+:\/\/)(.*?)\//i', "/" , $_SERVER['QUERY_STRING'] ); } ?> Hope this helps someone else out there trying to do the same thing :) If anyone finds a better way, please let met know, I'm still learning ;) ---- Server IP: 87.124.64.96 Probable Submitter: 82.153.225.103 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/78597 Del: integrated -- https://master.php.net/note/delete/78597/integrated Del: useless -- https://master.php.net/note/delete/78597/useless Del: bad code -- https://master.php.net/note/delete/78597/bad+code Del: spam -- https://master.php.net/note/delete/78597/spam Del: non-english -- https://master.php.net/note/delete/78597/non-english Del: in docs -- https://master.php.net/note/delete/78597/in+docs Del: other reasons-- https://master.php.net/note/delete/78597 Reject -- https://master.php.net/note/reject/78597 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131509) next »