Gallery3 problem when index.php is hidden

Help with issues related to Eye-Fi Center for the web and mobile devices

Gallery3 problem when index.php is hidden

Postby CliffS » Thu Mar 08, 2012 1:06 pm

Hi there,
Eye-fi and Gallery3 are starting to work well for me. Finally getting the system working. There's one bug, however:
If you set up Gallery3 in completely vanilla format, albums will have URL's like this: http://www.example.com/gallery3/index.php/goodpix

According to Gallery3 documentation, that unnecessary <index.php/> string can be removed from the URL by editing the .htaccess file
(see the how-to-do-this at http://gallery.menalto.com/node/103713

If you follow the Gallery3 instructions and edit the .htaccess file, then the URL for a photo looks like http://www.example.com/gallery3/goodpix << GREAT!

However, doing this breaks the eye-fi to Gallery3 uploading! The Eye-fi remote access stops, and won't upload. << TERRIBLE!

The eye-fi to Gallery3 connection uses the REST API and apparently, the eye-fi side assumes that it must have the <index.php> in the directory.

Can someone who knows this stuff look into this? Is there a workaround?
Many thanks! -Cliff
CliffS
 
Posts: 24
Joined: Wed Aug 20, 2008 5:09 pm
Location: Berkeley, California

Re: Gallery3 problem when index.php is hidden

Postby jsun » Thu Mar 08, 2012 10:52 pm

hi CliffS,

I've helped a couple of other Gallery 3 users who also encountered this issue. They weren't able to connect from Eye-Fi without commenting out those rules.

I'm not one of the engineers so I can't speak with authority here, but I think the issue is that our Gallery 3 support is based on their official documentation, where all calls to the REST API (which we need to reach) include "/index.php/rest". http://codex.gallery2.org/Gallery3:API:REST

You may be able to rewrite/redirect other URLs to eliminate "/index.php/", but I don't think you can skip it here.

The Gallery 3 .htaccess file includes this last rule:
Code: Select all
RewriteRule ^index.php/(.*) $1 [QSA,R,L]

If I am parsing it right, this line would redirect "/index.php/rest" to just "/rest", so it could be our culprit.

If you comment that line out and restart the server, does this allow Eye-Fi uploads? Does it break anything else? I'd hope that the worst it does is allow people to still access your site using longer URLs instead of redirecting their browser to the shorter URL.

If that works, I imagine a more elegant solution is to tell mod_rewrite to not rewrite anything starting with "index.php/rest". I don't have a Gallery 3 server to mess with so I can't test it personally, but it can probably be done in 1 line.

I hope this helps! Please report back, we'd love to hear the results.

Jason
Eye-Fi Customer Care
User avatar
jsun
Eye-Fi'er
 
Posts: 748
Joined: Sat May 14, 2011 11:01 pm

Re: Gallery3 problem when index.php is hidden SOLVED BY JASO

Postby CliffS » Fri Mar 09, 2012 12:06 am

HOT ZIGGITY, JASON!

Yessss -- you're right! That solved it. With that one line commented out, the eye-fi photos upload properly (via the Rest API) into Gallery3. And the other lines cause the index.php to disappear from the URL.

In case anyone else has the same troubles, tell 'em to edit file .htaccess (located in the Gallery3 root folder).
Last lines in the file should look like this:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /gallery
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]
# next line commented out to allow the REST API to work properly with EYE-FI. -Cliff Stoll 2012/3/8
# see viewtopic.php?f=21&t=6260
# RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>

(Oh - it's also necessary to also have the Apache mod_rewrite and AuthConfig Indexes properly set)
CliffS
 
Posts: 24
Joined: Wed Aug 20, 2008 5:09 pm
Location: Berkeley, California

Re: Gallery3 problem when index.php is hidden

Postby jsun » Fri Mar 09, 2012 12:58 pm

Excellent! Glad to hear that took care of it.

If anyone running a Gallery 3 server would like to go a step further, try adding a rule that tells mod_rewrite to not rewrite requests starting with "index.php/rest" and also skip the other rules (probably using the "L" flag). Once that is there, hopefully you can un-comment the other one.
User avatar
jsun
Eye-Fi'er
 
Posts: 748
Joined: Sat May 14, 2011 11:01 pm


Return to Eye-Fi Center for the web

Who is online

Users browsing this forum: No registered users and 2 guests