From a7bd28ce0b08b5198425c6625eeb001a216dec51 Mon Sep 17 00:00:00 2001 From: Magnus Enger Date: Fri, 13 Nov 2020 10:44:29 +0100 Subject: [PATCH] Bug 27009 - Use 301 to redirect from tracklinks.pl The default for the tracklinks.pl redirect is "302 Moved Temporarily". It makes more sense to use "301 Moved Permanently". To test: 1. Set TrackClicks = Track 2. Make sure you have a MARC record with an external link in 856$u 3. In the OPAC, click on the link and use e.g. Developer tools to check on the HTTP status code sent by tracklinks.pl. It will be 302. 4. Apply this patch and restart all the things 5. Click on the external link in the OPAC again. The status code should now be 301. --- opac/tracklinks.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index ab07f033be..ad9702230b 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -78,7 +78,10 @@ if ($uri && ($biblionumber || $itemnumber) ) { itemnumber => $itemnumber } ) if ( $tracker->trackingmethod() eq 'track' || $tracker->trackingmethod() eq 'anonymous' ); - print $cgi->redirect($uri); + print $cgi->redirect( + -uri => $uri, + -status => '301 Moved Permanently', + ); exit; } } -- 2.11.0