Embed Gallery and mod_rewrite

Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Sun, 2005-09-11 05:27

Integrated Gallery: http://www.guildregister.com/index.php?ind=gallery2
Stand-Alone Gallery: http://www.guildregister.com/gallery/embed/v/

Currently I have a multi-site gallery setup in /gallery/embed and I have my integration page calling upon it from /mkportal/modules/gallery2 using the above Integrated Gallery link. As you can see it seems to work fine. The only difference between the Integrated and Stand-alone is that mod_rewrite for shorter URLs works with the Stand-alone but not the integrated. I believe I need to fix it by adding the .htaccess into my integrated directory of /mkportal/modules/gallery2 or I need to modify the .htaccess that is in the embed gallery.

This is what the original .htaccess is:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /gallery/embed/

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

    
    RewriteCond %{THE_REQUEST} \ /gallery/embed/admin/(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /gallery/embed/main.php?g2_view=core.SiteAdmin   [QSA,L]

    RewriteCond %{THE_REQUEST} \ /gallery/embed/v/(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /gallery/embed/main.php?g2_view=core.ShowItem   [QSA,L]

    RewriteCond %{THE_REQUEST} \ /gallery/embed/d/([0-9]+)-([0-9]+)/([^\/]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /gallery/embed/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2   [QSA,L]

    RewriteCond %{THE_REQUEST} \ /gallery/embed/v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /gallery/embed/main.php?g2_view=core.ShowItem&g2_path=%1   [QSA,L]

</IfModule>

# END Url Rewrite section

I had thought all I had to change was the RewriteRule part since the actual url but that didn't work. I had thought all I had to change was the RewriteRule part since the actual url but that didn't work. I thought since it is using the following that I to call the image then it would be all I needed to modify:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /gallery/embed/

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

    
    RewriteCond %{THE_REQUEST} \ /gallery/embed/admin/(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /index.php?ind=gallery2&g2_view=core.SiteAdmin   [QSA,L]

    RewriteCond %{THE_REQUEST} \ /gallery/embed/v/(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /index.php?ind=gallery2&g2_view=core.ShowItem   [QSA,L]

    RewriteCond %{THE_REQUEST} \ /gallery/embed/d/([0-9]+)-([0-9]+)/([^\/]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /index.php?ind=gallery2&g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2   [QSA,L]

    RewriteCond %{THE_REQUEST} \ /gallery/embed/v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !main\.php
    RewriteRule .   /index.php?ind=gallery2&g2_view=core.ShowItem&g2_path=%1   [QSA,L]

</IfModule>

# END Url Rewrite section

From my integrated page I initiate G2 using the following:

    	// initiate G2
  	$ret = GalleryEmbed::init( array(
           				'embedUri' => "index.php?ind=gallery2", 
					'embedPath' => "", 
					'relativeG2Path' => "gallery/embed",
           				'loginRedirect' => "/forum/index.php?act=login",
					'activeUserId' => $uid,
					)	);
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-09-11 11:06

- i guess you need to set embedPath to '/' instead of empty.
- you need to configure the url rewrite module twice when using it for embedded and standalone. if you want to use your g2 embedded, go to your embedded g2 (not the standalone g2), click there on the site admin -> url rewrite links. in the url rewrite admin view, you should see a setup tab for embedded setup where you have to enter the path to the embedded htaccess file etc. afterwards, go to the save tab and there hit save, only then it will save the G2 rewrite rules to the embedded .htaccess file.

 
pelle
pelle's picture

Joined: 2004-12-10
Posts: 389
Posted: Sun, 2005-09-11 11:59

http://codex.gallery2.org/index.php/Gallery2:EmbeddedRewrites (basically what valiant told you to do ;) )

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Sun, 2005-09-11 17:22

I have put in the incorrect path someplace and now it keeps trying to call upon /gallery/emebed/ instead of /gallery/embed/. I deleted the .htaccess, cleared template/database cache and browser cache. I then tried to reactive/setup URL rewrite and it still pulls from that. I downloaded the .htaccess file which had an extra //gallery/embed but embed was spelled correctly so I don't know where it is getting this information.

Standalone gallery is using /gallery/data for its data information and the multi-site gallery is using /gallery/embed as its directory. The integrated/embeded file is called using guildregister.com/index.php?ind=gallery2 and its index file is located in /mkportal/modules/gallery2/

When I am setting the htaccess path and public path am I directing it to /gallery/data, /gallery/embed or the /mkportal/modules/gallery2? I would think since there is no data in /mkportal/modules/gallery2 that I direct it to the embeded directory of /gallery/embed. The instructions on the codex say direct to the embedApp though is that talking about the embeded directory I have set for the albums of Gallery or does embedApp mean the actual file, in this case index.php calling upon gallery functions?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-09-11 17:41

when asked for the public path / url path in the setup, point it to http://www.guildregister.com/ -> empty form input field since the path is ''.
when asked for the .htaccess path, point it to your webroot filesystem path.