Convert gallery2 URL: http//www.example.com/php/gallery2/main.php?g2_itemId=15351 To valid G3 URL ??
veletron
Joined: 2007-07-16
Posts: 31 |
Posted: Tue, 2013-04-30 14:56 |
Hi I was not using (I don't think) re-write on gallery2, as such, my G2 URL's look like: http://www.veletron.com/php/gallery2/main.php?g2_itemId=15351 My new site is at http://photos.veletron.com and is an import of all the stuff from G2 I have tried the re-write code suggested during G3 install, but I believe that it expects to receive G2 URL's that were previously re-written, rather than the 'main.php?g2_itemId=15351' format above. My current Redirect is just a redirect to the G3 root when anything is requested from my old G2. I would like the G2 requests to be converted into G3 requests. Is this possible?? The re-write code I tried is thus: .htaccess at root of www.veletron.com: <IfModule mod_rewrite.c> My above example URL: http://www.veletron.com/php/gallery2/main.php?g2_itemId=15351 gets re-written to http://photos.veletron.com/g2/map?path=php/gallery2/main.php&g2_itemId=15351 I don't pretend to understand any of this!! My G2 no longer exists, the above is in a .htaccess on its own. I have also tried re-creating the old /php/gallery2/ path and placing the .htaccess in here instead. Any assistance appreciated! Nigel |
|
Posts: 814
There are probably a number of issues to your problem.
However, the first I see is that it appears you don't have the g2_import module enabled/installed on your new gallery. Check that, and if it's off, turn it on and try again.
Second, it appears that you -may- be running an older G3 install that has a few bugs with the G2 rewrite. What version of G3 are you running? (If it is the latest, see below)
Thirdly, the .htaccess with the rewrites should be in your old g2 location, not g3... (hard to tell by what you wrote, but you may have got this correct with the part where you said you recreated the old directory)
Fourthly, since you changed the directory structure (and subdomain) the rewrite rule will also have to be modified to reflect this, however, this is pointless until the first two items are checked/corrected.
Check this thread for more info... http://galleryproject.org/node/95551
Posts: 31
Hi
Thanks, I did not know that the G2 Import module needed to be on after the import to support the redirected URL's. My bad, RTFM me thinks. I can't get gallery3 to spit me out the .htaccess code because my old G2 install has gone, the stuff (.htaccess) I posted came off the internet (placed in old G2 root folder with changed RewriteBase). I think I see the bug you mention in another forum post together with the correction. I enabled the G2 import module, pasted the new .htaccess code, and re-jigged it for my new domain name and all is sorted, redirects working...
For anyone else having issues:
- My old gallery2 was at: http://www.veletron.com/php/gallery2/
- New gallery3 is at http://photos.veletron.com
I deleted the php tree in the 1st URL, and placed the following in a .htaccess file in the root folder for http://www.veletron.com
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /php/gallery2/
RewriteRule ^(.*)$ http://photos.veletron.com/index.php/g2/map?path=$1 [QSA,L,R=301]
</IfModule>
Lo and behold, redirects working! Thanks jNash & thanks Gallery Team!!
Nigel
Posts: 814
Good to see you got it sorted! Thanks for posting the fix you found as well!
Posts: 31
Hi
Not out of the woods yet, although stated galleries and items redirect perfectly, the root album won't redirect
The URL
http://www.veletron.com/php/gallery redirects to:
http://photos.veletron.com/index.php/g2/map?path=php/gallery2
I must be using the RewriteBase incorrectly...
Nigel
Posts: 31
EDIT: Updated with something that works (I think!).
This is all built into G3's G2 URL importer, but I found that it was not redirecting requests to the root of my old gallery to the root of my new gallery, I therefore needed a sort of if/else for redirects. I ended up checking for the presence of 'main.php' in the URL. If not there then it redirects to the G3 root if it is there then it redirects to G3's 'G2 URL parser'.
One should note that when testing this stuff, the browser will cache permanent redirects (301). I had both redirects working separately, but not together, but the cacheing made me think that they were working together. Change the ReWrite's to 302 (temporary redirects) for test purposes and test in a 'private browsing' tab 'incognito' in chrome. You can put them as 301's once it works.
Redirects required:
http://www.veletron.com/php/gallery -> http://photos.veletron.com
http://www.veletron.com/php/gallery/ -> http://photos.veletron.com
http://www.veletron.com/php/gallery2/main.php?g2_itemId=20357 -> Same gallery page on G3
http://www.veletron.com/php/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=20454&g2_serialNumber=2 -> Same image on G3
I have ended up with:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
#if main.php is present in URL redirect to G3's G2 URL parser to have it converted to G3 URL
RewriteCond %{REQUEST_URI} /php/gallery2/main\.php
RewriteRule ^(.*)$ http://photos.veletron.com/index.php/g2/map?path=$1 [QSA,L,R=301]
#if main.php not present in G2 URL redirect to G3 root
RewriteCond %{REQUEST_URI} /php/gallery2
ReWriteRule ^(.*) http://photos.veletron.com/ [QSA,L,R=301]
</IfModule>
Now I have to get similar working for a G2-->G3 migration where the G2 is embedded in Joomla 1.x... lots of URL mangling, and I need it to work from both inside Joomla and natively.
Nigel