I've completed my gallery2 import on a new gallery3 site and have been trying to get the g2/map to properly redirect from the old gallery to the new one. Unfortunately every entry I try using the rewrite from gallery2 returns a 404. For this example I'm using the 2012 album:
Kohana_404_Exception [ Page Not Found ]:
The page you requested, g2/map?path=2012/, could not be found.
Gallery2 URL: /gallery/2012
Gallery3 URL: /photos/2012
Rewrite URL: /photos/g2/map?path=2012/
var/log shows the following error: --- error: File not found: g2%2Fmap%3Fpath%3D2012
I've got the g2 import module enabled, but I'm wondering if there is something else needed? My .htaccess for gallery3 is as follows:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /photos
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>
If I look in the database, I see the following for the g2map:
+----+-------+-------+---------------+---------------+
| id | g2_id | g3_id | g2_url | resource_type |
+----+-------+-------+---------------+---------------+
| 6 | 42076 | 2 | gallery/2012/ | album |
+----+-------+-------+---------------+---------------+
Which does seem to match up with the 2012 album:
+----+---------------------+----------+------------+-------------+--------+----------+-------+-----------+------+----------+-----------+--------------+---------------------+--------------------+--------------+---------------+--------------+-----------+------+-------------+------------+-------------+--------------+-------------+-------+-------+------------+------------+--------+-------+--------+--------+
| id | album_cover_item_id | captured | created | description | height | left_ptr | level | mime_type | name | owner_id | parent_id | rand_key | relative_path_cache | relative_url_cache | resize_dirty | resize_height | resize_width | right_ptr | slug | sort_column | sort_order | thumb_dirty | thumb_height | thumb_width | title | type | updated | view_count | weight | width | view_1 | view_2 |
+----+---------------------+----------+------------+-------------+--------+----------+-------+-----------+------+----------+-----------+--------------+---------------------+--------------------+--------------+---------------+--------------+-----------+------+-------------+------------+-------------+--------------+-------------+-------+-------+------------+------------+--------+-------+--------+--------+
| 2 | 4858 | NULL | 1343727495 | | NULL | 9556 | 2 | NULL | 2012 | 2 | 1 | 0.1133170000 | 2012 | 2012 | 1 | NULL | NULL | 9935 | 2012 | weight | ASC | 1 | 113 | 150 | 2012 | album | 1367856056 | 188 | 2 | NULL | 1 | 0 |
+----+---------------------+----------+------------+-------------+--------+----------+-------+-----------+------+----------+-----------+--------------+---------------------+--------------------+--------------+---------------+--------------+-----------+------+-------------+------------+-------------+--------------+-------------+-------+-------+------------+------------+--------+-------+--------+--------+
Posts: 4
We week with no suggestions doesn't bode well for the future of this project
Posts: 1857
If the only change you made was the name of the folder, you should just skip over the whole mapping thing and use a rewrite.
More to your point, did you read the instructions for import? It specifically says:
6. Rename your g2 folder to something else (e.g. from "gallery" to "gallery_old")
7. Rename your g3 folder to what the g2 folder used to be (e.g. "gallery3" to "gallery")
http://codex.galleryproject.org/Gallery3:Modules:g2_import
Uhm, yeah.
Posts: 4
Hi tempg, thanks for the suggestions. I think you are correct and a rewrite without the mapping will be the easiest way to resolve. One thing to note, the old URLs on items is different than new URLs (e.g. G2 item is /album/photo.extension.html, G3 is /album/photo). Do you suggest just removing any instances of ".jpg.html" in the URL via rewrite, or is that going to break some other functions?
Posts: 1857
If you changed the folder name, that wouldn't matter; make the change in the old folder's htaccess file and it won't affect anything in the new folder.
Having said that, I don't think the making that change with rewrite will cause any issues, but if it does result in something going wrong, just change it back. (Backups are golden.)
Posts: 4
For anyone stuck in the same situation, the following .htaccess allowed me to redirect anyone going to /gallery to the new /photos URL, as well as remove .jpg.html from any old g2 URLs for use in gallery3:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/gallery(.*?)(\.(jpe?g|gif|png)\.html)?$ /photos$1
</IfModule>