|
Posted by Shaun on 10/28/06 02:12
On 26 Oct 2006 10:33:23 -0700, "comp.lang.php"
<phillip.s.powell@gmail.com> wrote:
> $url = $redirectArray[$id]['attributes']['URL'];
> if (trim($redirectArray[$id]['attributes']['QUERY_STRING']) !== '?')
>$url .= '?';
> $url .= preg_replace('/=/i', '=',
>$redirectArray[$id]['attributes']['QUERY_STRING']);
> $url = preg_replace('/\/$/', '', $url); // REMOVE TRAILING / TO
>ACCOMMODATE QUERY STRING AND/OR ANCHOR
>
>If the URL happens to be this:
>
>http://the-nordic-one.livejournal.com#alchemymemory10242006
>
>Instead it winds up looking like this every single time:
>
>http://the-nordic-one.livejournal.com/#alchemymemory10242006?
It appears that the code is missing a set of curly braces; this is
causing the first call to preg_match() to fire unconditionally, which
means that the query string is always going to be appended to the URL
(even if it's only '?').
Try this:
$url = $redirectArray[$id]['attributes']['URL'];
if (trim($redirectArray[$id]['attributes']['QUERY_STRING']) !== '?') {
$url .= '?';
$url .= preg_replace('/=/i', '=',
$redirectArray[$id]['attributes']['QUERY_STRING']);
}
$url = preg_replace('/\/$/', '', $url); // REMOVE TRAILING /
hth
-
Remove mypants to email.
<http://www.shaunc.com/>
[Back to original message]
|