Gallery2->Gallery3 URL Rewrite prefix

gunebakan

Joined: 2006-06-06
Posts: 5
Posted: Tue, 2012-01-17 11:05

Hi,
On gallery2 there have been /v/ for views /d/ for download prefixes at the url. I can't see an option or module for url_rewrite on gallery3. Because there are link to old prefixed urls like http://hede.com/v/new_york_album etc. I need to use same prefixed urls. How can I achieve this?

Thanks,
Barış

 
tempg

Joined: 2005-12-17
Posts: 1633
Posted: Tue, 2012-01-17 17:46

The import module should have automated the redirects for you.
It's a bit more complicated to do it by hand.

I'm not sure if you're saying that you want the "v/" added to each url, or if you just want the old urls to work (instead of generating error messages).
Assuming the latter, change the bottom section of the htaccess to:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^/v/(.*)$ http://hede.com/$1 [QSA,L,R=301]
</IfModule>

For the download prefixes, that's where the import module is the best solution. I don't remember how the "/d/" urls are structured, so I can't really say much on that.

 
gunebakan

Joined: 2006-06-06
Posts: 5
Posted: Wed, 2012-01-18 11:01

Hi,
The issue I mention can be found at the FAQ: http://codex.gallery2.org/Gallery2:FAQ#My_Gallery_URLs_begin_with_.2Fv.2F_and_.2Fd.2F.2C_why.3F
import module did not handled my .htaccess file. My old rule was:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

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

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

All of my url open like:
http://hede.com/v/1album
http://hede.com/v/2album
http://hede.com/v/3album

but now:
http://hede.com/1album
http://hede.com/2album
http://hede.com/3album

So I lose the pagerank.

Thanks
Barış Efe

 
tempg

Joined: 2005-12-17
Posts: 1633
Posted: Thu, 2012-01-19 17:15

1) Are you that the import module's htaccess files were put in the proper locations (see steps 4-9)? http://codex.gallery2.org/Gallery3:Modules:g2_import

2) Did you try adding the code that I listed above to the root htaccess file?

 
gunebakan

Joined: 2006-06-06
Posts: 5
Posted: Thu, 2012-01-19 20:52

Hi,
1) I tried but it gives 404 error page.
2) Yes

I actually find that
RewriteCond %{THE_REQUEST} /v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteRule ^v/(.*) $1 [QSA,L]

or with redirect
RewriteRule ^v/(.*) $1 [QSA,R,L]

is working but default links are without /v/

Barış

 
tempg

Joined: 2005-12-17
Posts: 1633
Posted: Thu, 2012-01-19 21:04

I'm a bit confused, but let's start from where you are now.

Are you saying that it works now?

If not and you just [b]want[/] the "/v/" added to the gallery urls, can't you install (move) the entire gallery in a folder (named "v")?

 
gunebakan

Joined: 2006-06-06
Posts: 5
Posted: Fri, 2012-01-20 00:10

Right now I am using gallery2 and url is:
http://hede.com/v/album1
I upgraded to gallery3 with g2_import and album1 url changed to:
http://hede.com/album1

There were "URL Rewrite Administration" page on gallery2:

Thanks

 
tempg

Joined: 2005-12-17
Posts: 1633
Posted: Fri, 2012-01-20 15:17

Sound like you WANT the "/v/"
Just move the entire Gallery into a folder called "v" and that will do it.