forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: kubizo on December 01, 2011, 07:14:25 pm

Title: Add to Favorites creates a 302 redirect - can we change it to 301?
Post by: kubizo on December 01, 2011, 07:14:25 pm
Hi everyone!

I had my gallery (http://www.kubizo.com (http://www.kubizo.com)) scanned by a SEO software and it looks like one of the problems is the following.

The page "addfav.php" is called with pid and referer as parameters. Once the picture has been added to the user's favorites, the browser is redirected to the page with the picture itself.

THE PROBLEM IS: the redirect performed by addfav is a temporary one (302), which search engines do not like. Is there a way to make it become a 301?

ALTERNATIVE SOLUTION: given how much my visitors are using the favorites (=not at all), I could very much disable the whole thing, but I could not figure out how to do it in the config page of my gallery.

Thanks a lot everyone!
Title: Re: Add to Favorites creates a 302 redirect - can we change it to 301?
Post by: kubizo on December 01, 2011, 09:57:29 pm
I tried replacing the last lines of the addfav.php file with:

Code: [Select]
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$ref);

For some reason I don't understand, it still gives me a 302 :-(

Any help would be most welcome! Thanks everyone!
Title: Re: Add to Favorites creates a 302 redirect - can we change it to 301?
Post by: Αndré on December 02, 2011, 12:05:00 pm
ALTERNATIVE SOLUTION: given how much my visitors are using the favorites (=not at all), I could very much disable the whole thing, but I could not figure out how to do it in the config page of my gallery.
As there's no config option, you have to edit displayimage.php. Find
Code: [Select]
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" >" . $lang_picinfo['remFav'] . '</a>';
    }
and remove it completely.
Title: Re: Add to Favorites creates a 302 redirect - can we change it to 301?
Post by: kubizo on December 02, 2011, 04:18:08 pm
Thanks a lot!

Have a great day!