Gallery 2 Robots.txt

You can prevent robots (search engines) from visiting Gallery pages which are of no use to them. Some examples are :

  • Advanced Search
    /main.php?g2_view=search.SearchScan&g2_form%5BuseDefaultSettings%5D=1&g2_return=%2Fgallery%2Fmain.php%3F
    
  • Login
    /main.php?g2_view=core.UserAdmin&g2_subView=core.UserLogin&g2_return=%2Fgallery%2Fmain.php%3F
    
  • Add Comment
    /c/add/
    
  • Shutterfly
    /main.php?g2_view=shutterfly.PrintPhotos&g2_itemId=80511&g2_returnUrl=http%3A%2F%2Fexample.com%2Fgallery%2Fmain.php%3Fg2_path%3Dexamplepath%2Fphoto.jpg.html&g2_authToken=6c4286fe85d0
    
  • Ecard
    /main.php?g2_view=ecard.SendEcard&g2_itemId=80511&g2_return=%2Fgallery%2Fv%2Fexamplepath%2Fphoto.jpg.html
    
  • Slideshow
    /v/slideshow/
    
    • See this page for instructions on changing the Gallery rewrite settings for the slideshow. Then you can use the preceding url stem for a robots disallow.

You can do this by adding the following lines to your robots.txt file :

Disallow: /main.php?g2_view=search.SearchScan&
Disallow: /main.php?g2_view=core.UserAdmin&
Disallow: /c/add/
Disallow: /main.php?g2_view=shutterfly.PrintPhotos&
Disallow: /main.php?g2_view=ecard.SendEcard&
Disallow: /v/slideshow/

Note : The comments link and robots.txt line assume you've enabled the rewrite plugin for comments.

Note : If you've installed gallery into a sub-directory like http://www.example.com/gallery/ then your robots.txt lines will need to be prefixed by that same path (e.g. Disallow: /gallery/c/add/)

Note : Keep in mind that the way a robots.txt file is parsed is very simple. It's a substring search from the beginning of the path. No globbing or Regular Expressions are allowed.

You can test and confirm that your robots lines are doing what you want by using Google's Webmaster Tools, just add your site, verify it, then in the Dashboard under "Site Configuration" ... "Crawler Access" you can test URLs from your site.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.