[wp-hackers] Please Help: Gallery2 Rewrites and Wordpress Pages

ozgreg wphackers at galleryembedded.com
Mon Jul 9 02:43:21 GMT 2007

Part of the technical challenges in combining Gallery2 Output within Wordpress is the clash of the Wordpress Greedy Rewrite Rules and Gallery2.

In the past, we found the most robust way to stop rewrite rules from returning 404's was to direct the output to an external php page which in turn generates a "Wordpress Page"..

Although this approach is very robust it is never desirable to have to add an additional file to the Wordpress Root Directory and it is something we want to avoid.

I have many an attempt to instead build a internal Wordpress Page and added a hook to perform a termplate redirect and although this approach works well within Wordpress as soon as Gallery2 Rewrite Rules are added to the Mix the entire solution goes south with 404 errors ..

For Example 

Wordpress Page -> /photos
Gallery2 URL -> /photos/Images

Gallery 2 rewrite rule 

    RewriteCond %{THE_REQUEST} /photos/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/photos$
    RewriteRule .   /photos?g2_path=%1   [QSA,L]

URL sent to Wordpress would then be /photos/Images which Wordpress Cannot Find (IS_404)

I believe solution would be to change the internal Wordpress Rewrite Rules


to be more greedy to redirecting any children Pages of photos to the parent photos but to be honest rewrite structures are not my strength and would love some feedback, suggestion or ideas on how to handle this..

WPG2 Installation, Operation & FAQ Documentation (http://wpg2.galleryembedded.com/)

-------------------- m2f --------------------

Gallery2 Embedded Forums (http://www.galleryembedded.com/forums/)
-------------------- m2f --------------------

More information about the wp-hackers mailing list