G2 to G3 url rewrite

Vanny

Joined: 2006-02-10
Posts: 8
Posted: Mon, 2014-02-10 20:19

I'm finally biting the bullet and trying to move away from G2 and into the considerably smoother, better looking and easier to manage G3. Installation of G3 was straight forward and i got it up and running quickly. Importing all the pictures from G2 was also straight forward using the G2 Import Mod, but i've become stuck!

My URL rewrite doesn't work, and for the life of me i can't figure out why.

I think the basics are checked, URL Rewrite code is at the top of the gallery2/.htaccess file (the g2 install is still present in its entirety), G2 Import is still switched on, and gives options in G3 settings.

The rewrite is working, in that it is removing /gallery2/ and replacing it accordingly from any request, but it seems the G2 import module isn't interpreting the request correctly.

I've tried to put as full a detail as I can below.

Anyone have any ideas?

================================================================

Base URL
http://www.bxproject.co.uk

JPG being called from
http://www.bxclub.co.uk/forum/viewtopic.php?f=15&t=16299

Example old URL to JPG (from server log)
/gallery2/d/4659-3/Tap+55.jpg

Current URL REWRITE in gallery2/.htaccess gives
http://www.bxproject.co.uk/gallery3/g2/map?path=d/4626-3/Tap+44.jpg

Example of where the actual picture now is
http://bxproject.co.uk/gallery3/var/albums/mods/cooling/htapcng/Tap%2044.jpg?m=1391534863

Gallery 2 embed.php is at
/homepages/4/d69011044/htdocs//bxproject/gallery2/embed.php

G2 Import is turned ON in gallery and the suggested REWRITE code is

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /gallery2/
RewriteRule ^(.*)$ /gallery3/g2/map?path=$1 [QSA,L,R=301]
</IfModule>

Current .htaccess looks like


<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /gallery2/
RewriteRule ^(.*)$ /gallery3/g2/map?path=$1 [QSA,L,R=301]
</IfModule>

## BEGIN Url Rewrite section
##(Automatically generated. Do not edit this section)
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /gallery2/

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
RewriteRule . - [L]

RewriteCond %{THE_REQUEST} /gallery2/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
RewriteRule . /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L]
RewriteCond %{THE_REQUEST} /gallery2/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
RewriteRule . /gallery2/main.php?g2_path=%1 [QSA,L]
RewriteCond %{THE_REQUEST} /gallery2/f/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
RewriteRule . /gallery2/main.php?g2_controller=permalinks.Redirect&g2_filename=%1 [QSA,L]
</IfModule>

## END Url Rewrite section

Places looked for help
http://galleryproject.org/node/95551
Suggests the .htaccess i have should work. It works for links to albums, but not to individual files jpgs

Accessing
http://www.bxproject.co.uk/gallery3/g2/map?path=d/4626-3/Tap+44.jpg
directly gives the error;

Platform information

Host name: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
Operating system: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
Apache: Unknown
PHP: 5.4.24
MySQL: 5.1.72-log
Server load: 8.62 10.33 8.39
Graphics toolkit: imagemagick

Gallery stats

Version: 3.0.9 (Chartres)
Albums: 72
Photos: 947

Kohana_404_Exception [ Page Not Found ]:The page you requested, g2/map?path=d/4626-3/Tap 44.jpg, could not be found.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2014-02-15 05:02

I didn't import from G2; I did fresh installs and re-uploaded everything (for other reasons). Having said that:

Vanny wrote:
the g2 install is still present in its entirety

I don't think that's the way it's designed to work.

After you've successfully imported to G3, you copy the htaccess that import generates into the G3 htaccess file and then change the names so that G3 sits where G2 used to sit.

Check steps 6-8: http://codex.galleryproject.org/Gallery3:Modules:g2_import

=====

If, for some reason, you NEED to have a new directory for G3 than whatever you used for G2, you need to change the rewrite rules (not the conditions, though). So, for example, I think that RewriteRule . /gallery2/main.php?g2_path=%1 [QSA,L] would have to change, but I'd have to test and look at how the mapping works to be sure.

 
Vanny

Joined: 2006-02-10
Posts: 8
Posted: Sat, 2014-02-15 08:52

tempg, it seems to depend on which guide you read. You can either use a rewrite to redirect everything from the old dir to the new one, or rename the dirs so new becomes old.

I've tried both, at length. I did manage to get a small amount of success, but only as far as redirecting some specific images.

The top of my Gallery2/.htaccess file now looks like this

Quote:
RewriteBase /gallery2/
RewriteRule ^.*([dv]/.(?:jpg|jpeg|png|bmp))$ /gallery2/g2/map?path=$1 [QSA,L,R=301]

the G2_Import suggestion looks like this;

Quote:
RewriteBase /gallery2/
RewriteRule ^(.*)$ /gallery2/g2/map?path=$1 [QSA,L,R=301]

Ultimately no external links work now, so i'm thinking i might as well just save myself some grief and move away from the Gallery3 system and to something a bit better supported. I only use this gallery system to host my own pictures, not for other users, and while G3 takes away a lot of the faff of G2 administration, the two systems are too different to be fully compatible.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2014-02-15 14:31
Vanny wrote:
i might as well just save myself some grief and move away from the Gallery3 system and to something a bit better supported

Ok. That works. I'm certainly don't want to put time into this if you're moving on.
Best of luck for whatever you end up using.