G2 -> G3 URL rewrite rules?

snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Wed, 2010-04-14 01:32

I'm following my 404s after upgrading to G3 RC1 and I'm trying to figure out how to redirect all .jpg.html pages to the top level of my new gallery. I would work to strip the .jpg.html "extension" from G2 and redirect requests 1-1 but not all my new URLs use the filename.

I'm trying things like this in my .htaccess, without success:
RewriteRule ^gallery/(.*)\.jpg.html$ http://www.abc.com/gallery/ [R=301,L]

Any ideas?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-04-14 06:59

If you go through the G2 Import process it has a list of rewrite rules at the bottom of the import page.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Wed, 2010-04-14 11:31

Thanks, I had issues during the G2 import process did not get the rules written down or into my .htaccess during my second shot at upgrading.
If anyone has them and could kindly share!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-04-14 13:40

To get settings just for your setup, go to Admin > Settings > Gallery 2 Import

The bottom of the page will contain those. If not here are mine:

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

Change the 2 directories in bold to match your setup. I've only installed G3 as a test so far and haven't replaced a G2 install with it in the same place yet.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Wed, 2010-04-14 17:46

Thanks! ...as I have nothing below the file import path area on my G2 import page. I do recall it coming up during import and i copied for safe keeping but then due to import issues my priorities and focus changed

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Wed, 2010-04-14 18:06
Quote:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /gallery2/
RewriteRule ^(.*)$ /gallery3/g2/map?path=$1 [QSA,L,R=301]
</IfModule>

Hmm playing with it and not working, my G3 install doesn't have a /g2/ folder in the path.
My G2 = /gallery2
My G3 = /gallery

I've tried
RewriteBase /gallery/
RewriteRule ^(.*)$ /gallery2/g2/map?path=$1 [QSA,L,R=301]
and
RewriteBase /gallery2/
RewriteRule ^(.*)$ /gallery/g2/map?path=$1 [QSA,L,

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-04-14 18:14

Where are you putting those rewrite rules? It should be in an .htaccess file in your old G2 location.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Wed, 2010-04-14 18:50

Ah! My old G2 location is gone.... I'll rebuild the structure.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-04-14 18:53

No need to rebuild the structure. Just need to create that old gallery2 directory and an .htaccess file, then put those rewrite rules in that location.

That would explain why you probably didn't see those rules anymore, because the G2 Import module in G3 couldn't find embed.php for your G2 install :)

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Sat, 2010-08-21 19:22

Still struggling with this, both old and new Gallery's were in the same directory /gallery/ and I end up in an endless loop:

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

Since the path to my images are the same in G3 with G2 I'm trying to trim the old extension: .jpg.html
Trying to get: this /DSC_3469.jpg.html to this /DSC_3469

RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.jpg.html
RewriteRule (.*)\.jpg.html$ /$1/ [L,R=301]

I'm no good at .htaccess :-(

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Sun, 2010-08-22 02:45

Got it, had to add /gallery/ to the 4th line /gallery/$1/

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /gallery	
	RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.jpg.html
	RewriteRule (.*)\.jpg.html$ /gallery/$1/ [L,R=301]
</IfModule>

and for files I renamed with G3
RewriteRule ^gallery/DSC_7005 http://www.domain.com/gallery/MyImage [R=301,L]

 
simmons

Joined: 2009-11-15
Posts: 7
Posted: Mon, 2010-12-27 10:38
 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2010-12-29 19:24

@simmons: the same advice for snackmaster should work for you.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!

 
Whiskerfish

Joined: 2009-06-08
Posts: 15
Posted: Wed, 2010-12-29 23:28

Sorry guys I know this might be a basic or even stupid question but my Current Gallery 2 htaccess has a redirect from Gallery 1. Should I clear that out first or add in the new redirect above it?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2010-12-30 07:46

Hm. I can't remember what the G1->G2 redirects look like! I'd try leaving them both in place and see if it works.. if it does, theoretically it'd redirect G1 urls -> G2 urls -> G3 urls and it'd be ok.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!