Problem with navigation using G2 with URL Rewrite enabled

bramvanoirschot

Joined: 2006-04-27
Posts: 3
Posted: Thu, 2006-04-27 15:06

Hello,

Recently I upgraded my Gallery to version 2.1.1. I installed ISAPI-Rewrite Lite and enabled the URL-Rewrite module with success.
The only problem I now have is that the page-navigation doesn't work anymore. When I have more pictures in an album and I click next-page or just the "2" or "3" as page-index it just goes back to page 1.

I hope someone has a solution to the problem.
URL : http://www.bramvo.net (click : Gallerij (The main-frame will switch to http://fotos.bramvo.net which is the url to my gallery)

Content of http.ini (ISAPI_Rewrite Lite):
--------------------------------
[ISAPI_Rewrite]

# Defend your computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
# BEGIN Gallery 2 Url Rewrite section (GalleryID: c:\Inetpub\wwwroot\Galleria)
# Do not edit this section manually. Gallery will overwrite it automatically.

RewriteCond Host: fotos\.bramvo\.net
RewriteRule /modules/rewrite/data/isapi_rewrite/Rewrite.txt /modules/rewrite/data/isapi_rewrite/Works.txt [O]

RewriteCond Host: fotos\.bramvo\.net
RewriteRule /sitemap /main.php?g2_view=sitemap.Sitemap [N]
RewriteCond Host: fotos\.bramvo\.net
RewriteRule /sitemap?(.*) /main.php?g2_view=sitemap.Sitemap&$1 [N]

RewriteCond Host: fotos\.bramvo\.net
RewriteRule /d/([0-9]+)-([0-9]+)/([^\/\?]+) /main.php?g2_view=core.DownloadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3 [N]
RewriteCond Host: fotos\.bramvo\.net
RewriteRule /d/([0-9]+)-([0-9]+)/([^\/\?]+)?(.*) /main.php?g2_view=core.DownloadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3&$4 [N]

RewriteCond Host: fotos\.bramvo\.net
RewriteRule /v/([^?]+) /main.php?g2_view=core.ShowItem&g2_path=$1 [N]
RewriteCond Host: fotos\.bramvo\.net
RewriteRule /v/([^?]+)?(.*) /main.php?g2_view=core.ShowItem&g2_path=$1&$2 [N]

# END Url Rewrite section
--------------------------------

Gallery version = 2.1.1 core 1.1.0.1
PHP version = 5.0.4 isapi
Webserver = Microsoft-IIS/5.0
Database = mysql 4.1.12a-nt, lock.system=database
Toolkits = Exif, Gd
Acceleration = full/172800, full/172800
Operating system = Windows NT SERVER02 5.0 build 2195
Default theme = matrix
Locale = en_US
Browser = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)

Login or register to post comments
mprofile

Joined: 2005-07-01
Posts: 1
Posted: Fri, 2006-05-05 11:54

Bram,

I also had this problem. It appears the regular expressions that are being written to the HTTPD.INI file are at fault.

Look at this code snippet:

RewriteCond URL .*\?.*view=core.DowtldoadItem.*
RewriteCond Referer: (?!.*://your.website.tld/.*)
RewriteCond Referer: (?!^$)

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/.* /gallery2/main.php?   [F,L]

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/admin/ /gallery2/main.php\?g2_view=core.SiteAdmin   [N]

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/admin/\?(.*) /gallery2/main.php\?g2_view=core.SiteAdmin&$1   [N]

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/d/([0-9]+)-([0-9]+)/([^\/\?]+) /gallery2/main.php\?g2_view=core.DowtldoadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3   [N]

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/d/([0-9]+)-([0-9]+)/([^\/\?]+)\?(.*) /gallery2/main.php\?g2_view=core.DowtldoadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3&$4   [N]

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/v/([^?]+) /gallery2/main.php\?g2_view=core.ShowItem&g2_path=$1   [N]

RewriteCond Host: your\.website\.tld
RewriteRule /gallery2/v/([^?]+)\?(.*) /gallery2/main.php\?g2_view=core.ShowItem&g2_path=$1&$2   [N]

I've had to had several \ chars BEFORE the ? chars. Because the ? aren't being taken literal but interpreted.

Good luck!

- Wouter

Login or register to post comments
bramvanoirschot

Joined: 2006-04-27
Posts: 3
Posted: Fri, 2006-05-05 12:50

Hello Wouter,

Thank you very much for your response. The solution works just fine, it solved the problem!

Bram.
http://www.bramvo.net

Login or register to post comments
bramvanoirschot

Joined: 2006-04-27
Posts: 3
Posted: Thu, 2006-05-11 17:56

Pfff,

too bad it didn't... I had some troubles getting the gallery to a new file location.
My gallery is on http://www.bramvo.net/gallery2/
Now I use the original httpd.ini but when I follow your advice the httpd.ini content is :

[ISAPI_Rewrite]
# BEGIN Gallery 2 Url Rewrite section (GalleryID: C:\Inetpub\wwwroot\www.bramvo.net\gallery2)
# Do not edit this section manually. Gallery will overwrite it automatically.

RewriteCond URL .*\?.*view=core.DowtldoadItem.*
RewriteCond Referer: (?!.*://www.bramvo.net/.*)
RewriteCond Referer: (?!^$)
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/.* /gallery2/main.php? [F,L]
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/admin/ /gallery2/main.php\?g2_view=core.SiteAdmin [N]
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/admin/\?(.*) /gallery2/main.php\?g2_view=core.SiteAdmin&$1 [N]
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/d/([0-9]+)-([0-9]+)/([^\/\?]+) /gallery2/main.php\?g2_view=core.DowtldoadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3 [N]
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/d/([0-9]+)-([0-9]+)/([^\/\?]+)\?(.*) /gallery2/main.php\?g2_view=core.DowtldoadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3&$4 [N]
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/v/([^?]+) /gallery2/main.php\?g2_view=core.ShowItem&g2_path=$1 [N]
RewriteCond Host: www\.bramvo\.net
RewriteRule /gallery2/v/([^?]+)\?(.*) /gallery2/main.php\?g2_view=core.ShowItem&g2_path=$1&$2 [N]

# Defend fotos computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
# BEGIN Gallery 2 Url Rewrite section (GalleryID: C:\Inetpub\wwwroot\www.bramvo.net)
# Do not edit this section manually. Gallery will overwrite it automatically.
RewriteCond Host: www\.bramvo\.net
RewriteRule /modules/rewrite/data/isapi_rewrite/Rewrite.txt /modules/rewrite/data/isapi_rewrite/Works.txt [O]
# END Url Rewrite section

# END Url Rewrite section

Thank you for taking a look at it.

Bram.
http://www.bramvo.net

Login or register to post comments