Friday, June 27, 2008

Gallery2 Search Engine Optimization

If you have Gallery2 web gallery and want that it will be searchable for different search engines like Google and Yahoo, there are many tips to optimize your web gallery.

I'll describe a few tips, for my opinion they are important and easy to implement.
  • Activate URL Rewrite plugin - with this feature, for example, your web gallery URL will look like: ".../gallery/barcelona_trip" instead of ".../gallery/main.php?g2_itemId=42". This URL will be more understandable for search engines.

  • Picture Caption - write meaningful title, summary, keywords and description for each picture, preferably not very common. For example, instead of writing "Croatia" you can write "Travel photography from Croatia" or "Plitvice National Park - Croatia".

  • Use keywords in filenames - rename your origin picture file names to meaningful names, for example "comino_island_malta_blue_lagoon_02.jpg".

  • 301 Redirect - the main file of Gallery2 is main.php that gets 302 redirect from index.php. 302 redirect is not so friendly for search engines; it is recommended to change it to 301 redirect:
    1. Backup index.php, this file is located in the root folder of your web gallery.

    2. Open index.php file and search for:

      $phpVm->header('Location: ' . $urlGenerator->makeUrl($path));

      Change this line with these two:

      $phpVm->header('Status: 301 Moved Permanently');
      $phpVm->header('Location: ' . $urlGenerator->makeUrl($path));

    You will not see any difference in your web gallery, the only way to check this, is with Firebug plugin for Firefox or HTTPWatch program for Internet Explorer.


See Also:
Enjoy,
Alex Webs.