Advanced search  

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

Pages: [1]   Go Down

Author Topic: Add to Favorites creates a 302 redirect - can we change it to 301?  (Read 3161 times)

0 Members and 1 Guest are viewing this topic.

kubizo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24

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!
Logged

kubizo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: Add to Favorites creates a 302 redirect - can we change it to 301?
« Reply #1 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!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Add to Favorites creates a 302 redirect - can we change it to 301?
« Reply #2 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.
Logged

kubizo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: Add to Favorites creates a 302 redirect - can we change it to 301?
« Reply #3 on: December 02, 2011, 04:18:08 pm »

Thanks a lot!

Have a great day!
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.