URL not quite right in WP sidebar items

Arj

Joined: 2009-04-13
Posts: 5
Posted: Mon, 2009-04-13 15:19

Howdy all

Excellent plugin. Everything is running well apart from one niggle. At the moment all the URLs created by the WPG2 sidebar blocks (Random Image / Album tree etc.) are generating the incorrect URL.

Instead of generating

http://example.com/gallery/v/album-name/

it is generating

http://example.com/v/album-name/

For some reason it isn't inserting the "gallery" path into the URL. Although the URL works without the /gallery/ bit the URL gets changed to http://example.com/gallery/main.php?g2_path=album-name . This is bad for two reasons. First it is ugly and secondly it is giving the same page two different URLs which search engines don't like.

Is it possible to make a few changes so that the '/gallery' path is included in the URL? If so what do I need to change. I am not familiar with php and from what I can tell the plugin is using the GalleryUrlGenerator so I am not sure what to do.

I am running with the wordpress installation (2.7.1) in the domain root.
The gallery (2.2.2) is in '/gallery'
I am using the WPG2 plugin (3.0.7)
I had gallery2 mod_rewrite enabled with the defaults.

Cheers

Arj

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2009-04-13 16:30

Did you activate the rewrite rules though WPG2, not directly though gallery?

Quote:
The gallery (2.2.2) is in '/gallery'

upgrade do to bugs and security issues.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Arj

Joined: 2009-04-13
Posts: 5
Posted: Mon, 2009-04-13 23:18
floridave wrote:
Did you activate the rewrite rules though WPG2, not directly though gallery?

Yes, the mod_rewrites have been activated via the WPG2 "Gallery2 Rewrites" tab and all tests have passed.

floridave wrote:
upgrade do to bugs and security issues.

Yup, understood but I want to get this working as a baseline first before I do an upgrade.

Here are my .htaccess files if it is any help:

Wordpress : http://www.pastie.org/pastes/445506
Gallery2 : http://pastie.org/445503

Arj

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-04-14 02:21

The only thing I can think of is to remove all the rules, test the behavior. Then add one rule at a time to see where the behavior changes to what you don't expect.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Arj

Joined: 2009-04-13
Posts: 5
Posted: Tue, 2009-04-14 23:23

Ok, I now have the /v/album-name working without being re-written but thinking about it, this is looking at the symptom rather than the cause. The .htaccess file is only changing the URL because the original URL output by wpg2 is incorrect because it doesn't have the path to the root of the gallery in it.

I would expect the '/gallery/' in all the wpg2 generated links in my site because that is where the gallery is installed.
I would expect '/gallery2/' in all the wpg2 generated links in your site because that is where it is installed.

That still means that the same page will have two links to it; one with /gallery/ (From within the gallery pages) and one without (From the WP pages) which doesn't do site crawlers any good.

Ideally I would like to fix the output of wpg2; unfortunately I am not a PHP developer and this looks beyond simple tinkering.

Arj

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2009-04-15 02:28

I am not a expert but you can force embedded urls:
config.php
$gallery->setConfig('mode.embed.only', false); change to true.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Arj

Joined: 2009-04-13
Posts: 5
Posted: Wed, 2009-04-15 09:35

No, good idea, I can see where you are going with it but all that does is restrict access to the gallery, the 'url' option isn't what is needed either since it static.

While I as in there I also tried setting $gallery->setConfig('baseUri', '/gallery/'); or $gallery->setConfig('baseUri', 'http://www.fqdn.com/gallery/'); to see if that would force the output of wpg2 to change but nothing seemed to affect it.

What I need is wpg2 to output the correct path prefixed URL (Would be happy with just a "Replace the following line in file A with X", I have a feeling it could be a one-line change); failing that, as a worst case scenario I use apache's mod_alias to setup permanent redirects to the correct /gallery/ location.

Naturally I would prefer the former option but needs must.

Arj

 
jens_k

Joined: 2007-01-28
Posts: 244
Posted: Wed, 2009-04-15 13:55

Hi Arj,

I am using nearly the same system as you.

Did you checked your settings for WPG2 at "WPG2 Paths" in the Dashboard?

Here are my settings:
=> gallery2 url: http://example.com/gallery/
=> url to wpg2 output: http://example.com/gallery/main.php
=> gallery2 file path: /absolute/path/to/your/gallery/ (e.g./var/www/gallery/

Hope this helps.

Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de

 
Arj

Joined: 2009-04-13
Posts: 5
Posted: Thu, 2009-04-16 13:14

Ahoi Jens.

I have ALMOST identical settings to you. The only difference is the "URL to WPG2 Output" which is the same as the gallery2 url.

=> gallery2 url: http://example.com/gallery/
=> url to wpg2 output: http://example.com/gallery

As you can see I am missing the trailing slash and the main.php. Unfortunately I cannot change this particular setting. The input box is greyed out. (I am logged in as an admin user) so not sure what to do next.

 
jens_k

Joined: 2007-01-28
Posts: 244
Posted: Thu, 2009-04-16 19:07

Hi Arj,

I think this does not matter anything.
The next I would try is to change your .htaccess for wp:
From my point of view you can delete lines 1-34. This is what my .htaccess looks like. But ensure to make a backup of your existing one before ;-)

If this is successful you should change the permissions to read-only for the webserver. Elsewhere wp is able to change the settings back...

If this test is not successful, you could delete lines 26-34 - they are twice in your .htaccess.

Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de