PDA

View Full Version : relative links without URI but only "?bla=1"


blueyed
09-24-2004, 06:37 AM
It seems that PhpDig (1.8.3) follows links like

<a href="?a=1&amp;b=2">link</a>

on http://localhost/path

to http://localhost?a=1&amp;b=2

instead of

http://localhost/path?a=1&amp;b=2

blueyed
10-12-2004, 06:05 AM
FIXED.. :)

in admin/robot_functions in line 780 add this:



elseif (substr($regs[8],0,1) == "?") {
$links[$index] = phpdigRewriteUrl($path.$file.$regs[8]);
}


This way links like <a href="?param=1">Link</a> on a page like http://domain.com/subdir/file are followed as http://domain.com/subdir/file?param=1 and not http://domain.com/subdir/?param=1

I hope this makes it into the next release.

Thank you.

blueyed
12-03-2004, 03:05 AM
please see http://www.phpdig.net/forum/showthread.php?t=1361

blueyed
12-06-2004, 03:23 AM
Fix for the fix.. replace the code I've suggested with this one.

The previous code would build links like "someuri.html?page=5?page=6".. :/

elseif( $regs[8]{0} == '?' )
{ // path/file is a query string - cut it from base file
$links[$index] = phpdigRewriteUrl( $path.preg_replace( '#\?.*#', '', $file ).$regs[8] );
}

It's below
elseif (substr($regs[8],0,1) == "/") {
$links[$index] = phpdigRewriteUrl($regs[8]);
}

and above
else {
$links[$index] = phpdigRewriteUrl($path.$regs[8]);
}