drupal 4.7.0. cvs( and rc3)
gallery 2.1.1.a
gallerymodule cvs.

i can access gallery in standlone site, url http://site/gallery2
and ,i can access gallery in drupal without url rewrite url http://site/gallery

i want to use rewrite link , so i came drupal into admin->setting->gallery->directory settings
URI of Gallery2:
http://site/gallery2/

use Autodetect Settings, and those info was writen by drupal.

Location of Gallery2 (Autodetected value):
/opt/lampp/htdocs/testdrupal/gallery2/
Location of Gallery2 (Autodetected value):
/index.php?q=gallery

i visited gallery, http://site/gallery, i can see all album ,
but when i click one album, i can 't see any pics. "page not found" was here.

the link (one of the albums) is http://site/v/test
drupal error log said that v/test not found

in the readme file of gallery2 http://codex.gallery2.org/index.php/Gallery2:How_to_Embed_Gallery2.1_in_...
, it said that

URL Rewrite does not have the same restrictions as the G2.0/Drupal4.6 version and should be automatically configured. To change the rewrite rules just access the URL Rewrite module config page via Drupal.

i do search in drupal site, and there is some topic about how to setting the embed g2 rewrite.
but all of them are not for drupal 4.7
so ,have someone can share something?

Comments

kiz_0987’s picture

Try going to the URL rewrite config page in G2 (via Drupal) and check the paths (there is a link to this in the gallery.module settings page). Try "Save" and "Test" to see if that helps.

ifly3years’s picture

thank u ,
but i have tried lots times.

now i try it again.

first ,i must start rewrite mod in alone gallery2 (not in drupal, i can't start it in drupal)
i activated the rewrite module in gallery2 admin.setting.

the 2nd step, i came to drupal --gallery to config rewrite module. this is the same as the link in gallery.module settings page

i tested lot ,
not change the rewrite rule.
or changed the .htacces path with "/opt/lampp/htdocs/testdrupal/gallery2"
changed the public path with"/gallery2" or “/gallery”

so many , whatever i change , when i saved and click the "test"
allway have one success in apache mod rewrite,but there should be 3 success.
there is nothing in galler .htaccess and embed .htaccess , just say testing write into files.....
the .htaccess file in /opt/lampp/htdocs/testdrupal/gallery2 , i chmod to 666

then i change the rewrite rule with gallery2/v/%path%, the url in gallery pic changed ,but it can't work, so when someone click the picture to link to http://site/gallery2/v/014uyBsRhZ.jpg.html, it came to homepage.
if i change the rewrite rule with gallery/v/%path%, the click link to http://site/gallery/v/014uyBsRhZ.jpg.html, came back again, the page look like http://site/gallery, seemed that the gallerymodule can't find the pic ,so it came to gallery home, so i see the same as http://gallery.

i don't know what i miss , to make this happen.
but alone gallery site can work with rewrite mod......

so ,i want to get some more infomantion to guide.

thanks

kiz_0987’s picture

The .htaccess path and public path for the embedded URL Rewrite must be for your Drupal .htaccess file, NOT your Gallery2 .htaccess file. So /opt/lampp/htdocs/testdrupal/gallery2 is probably incorrect.

ifly3years’s picture

thanks again,

i don't think this is right to change drupal .htaccess .
i did , before.

but , after saved , i can't access drupal self. all link can't be open.

firefox said that

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.2.0 (Unix) mod_ssl/2.2.0 OpenSSL/0.9.8a DAV/2 PHP/5.1.1 mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.2 Perl/v5.8.7 Server at iflytest.3322.org Port 80

so i have to delete the appended lines in .htaccess file.

kiz_0987’s picture

You must use a different .htaccess file than your Gallery2 one. It should be the Drupal one (this works for me and others). Can you please post your .htaccess file that caused you problems. Is this a multi-site install?

ifly3years’s picture

first ,i have to overview of my system to u.

xampp 1.5.1
drupal 4.7.0 rc3(cvs)
i have few site in this server use drupal, for test. but every directory have their own drupal.

gallery module cvs

i install drupal in "/opt/lampp/htdocs/testdrupal"
and gallery2 in "/opt/lampp/htdocs/testdrupal/gallery2"

the .htaccess with wrong in "/opt/lampp/htdocs/testdrupal" is below:

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

    RewriteBase /gallery/

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


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

</IfModule>

# END Url Rewrite section


#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root)$">
  Order deny,allow
  Deny from all
</FilesMatch>

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 4, Apache 2
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 5, Apache 1 and 2
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the prefix www.
  # you can use one of the following settings to force user to use only one option:
  #
  # If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
  # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  # RewriteRule .* http://example.com/ [L,R=301]


  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.73 2006/04/14 09:08:26 killes Exp $

just when i deleted the added lines by g2, my drupal can work .

kiz_0987’s picture

This seems wrong -- RewriteCond %{THE_REQUEST} \ /gallery/v/([^?]+)(\?.|\ .) should be either RewriteCond %{THE_REQUEST} \ /v/([^?]+)(\?.|\ .) or RewriteCond %{THE_REQUEST} \ /gallery/v/([^?]+)(\?.|\ .) depending on whether you want your urls to be http://www.example.com/v/album1 or http://www.example.com/gallery/album1 respectively.

Please try the following:
.htaccess path = /opt/lampp/htdocs/testdrupal
public path = /
ShowItem rule = v/%path%

ifly3years’s picture

thank u very very ...much. in a chinese word “非常感谢”!

after saved, i found that the two .htaccess were changed. not only the one in the root directory.

i can access the pic by the link "http://.../v/pic.jpg.html"

some others question,
1 i want to know how to do if i need "http//../gallery/v/pic.jpg.html", because /v maybe be used by some reason.
2 just plug pic in my blog ,so i need link like "..../pic.jpg" not ".../pic.jpg.html". in my system the link is ../%,,,,,,,
3 since use rewrite , i felt my system be slow. was it normal?

and thank u again with respect.

in chinese word (only personal )
"我对你的景仰,有如滔滔江水,绵绵不绝。" :)
:P

kiz_0987’s picture

You're welcome.

I use the following URL Rewrite Rule for Show Item gallery/%path%.

This gives me links like www.example.com/gallery/photo1.

To plug in photos you can use gallery filter (comes with gallery.module) or g2Image (supported by gallery.module, but you need to download it). These are mainly to show thumbnails in blogs with a link to the full image in G2.

I have not noticed any speed difference using URL rewrite.

ifly3years’s picture

thank u again.

let's end the topic.

bwv’s picture

Hi, I wonder if you can help me out as well. I am running Gallery 2 embedded in Drupal 4.7. (URL rewrite works fine in Drupal.) When I activate Gallery 2's URL rewrite in the embedded mode (the Show Item URL pattern is selected and set at gallery/%path%), hovering over a given album or image thumbnail displays the correct path in the status bar of the browser window. When one clicks on the album or image thumbnail, however, one is redicted to the main page of the gallery, even though in the URL address bar the correct, rewritten path to the image is designated (i.e., not this -- http://www.greystokefarm.com/?q=gallery&g2_itemId=821 -- but this -- http://greystokefarm.com/gallery/ponies/pistols_and_zarina.jpg ). This happens persistently throughout my site (http://greystokefarm.com) and I cannot figure out how to resolve it. I have verified that the URL rewrite module has write access to .htaccess in the gallery2 root directory on my server.

Another clue: Under Gallery Maintenance, when I check short style URLs for filesystem conflicts (and without the Show Item in URL rewrite selected), I get the following message:

Checked 157 items and found 1 conflicts
Bad path: Greystoke Farm's Image and Video Gallery: http://www.greystokefarm.com/

Note: Greystoke Farm's Image and Video Gallery is located at http://www.greystokefarm.com/gallery

Right now, I have not enabled URL rewrite because if I do visitors will be unable to view any of the images in the albums.

Thanks for any help with this, David

ifly3years’s picture

in fact ,i have the same question some days before. and i resolve it with kiz 's help.
but ,i did not know how it run .

all i do , is step by step , copy the infomation that he give to me. i tested for many times.

i think , maybe u should setup the path in g2 module admin, and , u have to set the permiss of the file .htaccess in gallery2.

now ,i choice the non clear link with g2, because i feel some slow with it. and i can't see the info.