Add to Favorites creates a 302 redirect - can we change it to 301? Add to Favorites creates a 302 redirect - can we change it to 301?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Add to Favorites creates a 302 redirect - can we change it to 301?

Started by kubizo, December 01, 2011, 07:14:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kubizo

Hi everyone!

I had my gallery (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!

kubizo

I tried replacing the last lines of the addfav.php file with:

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!

ΑndrĂ©

Quote from: kubizo on December 01, 2011, 07:14:25 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
    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.

kubizo