Re: Forward slashes and header requests
| From: | Jochem Maas | Date: | Sun, 24 Aug 2008 23:37:40 +0000 |
| Subject: | Re: Forward slashes and header requests | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278611@lists.php.net to get a copy of this message | ||
Dave M G schreef:
Ashley, Thank you for responding.if (empty($userRequest)) $userRequest = '/'; header("Location: http://{$serverName}{$userRequest}"); exit; note that redirects according to spec must contain an absolute URI (i.e. including the protocol and domain) ...although with works nicely in every modern browser. PS - can't believe I just wrote that given the rant about redirect I just let loose on the world. oh well, it is a CMS ... different rules apply ... or I'm just inconsistent or ... well Cumming no doubt has something to say about it ;-)best way to fix it was to use $location = str_replace('//','/', $_SERVER['REQUEST_URI']);Unfortunately the trim() command I use seems to destroy all slashes anyway, so this doesn't seem to have an impact. Thank you for the suggestion, though. Anyone have any other ideas?