WPG2: Creating rewrite rules for programming deficient, like me

dpaule

Joined: 2003-10-07
Posts: 30
Posted: Fri, 2006-11-10 23:11

This works for me without any problem, though without any variation on a working, clean installation of WordPress, G2 and WPG2, without any existing rewrite rules:

1. Firstly login to Wordpress as admin

2. Click on "View site"

3. Since I had the sidebar script, I clicked on a G2 thumbnail in the sidebar

4. Click on G2 admin login which appears through the embedded app!!! NOT in G2 or WordPress, put wherever G2 app appears within the embedded app (WordPress)

5. Uninstall Permalinks module and URL rewrite

6. Reinstall URL Rewrite module

7. Click on "Apache mod_rewrite" link that appears in URL Rewrite menu that appears

8. That opens up a menu asking for location of your embedded app, i.e. WordPress server path and url -> complete

9. Don't forget to touch .htaccess (and CHMOD 666) file in the embedded WordPress path in #8.

10. Voila, .htaccess file has been written to via G2.

11. If you want the embedded ap (WordPress) to have rewrites then you create those through the WordPress admin UI /module.

12. At this point you can reinstall Permalinks module (Remember, through embedded app)

13. REVALIDATE WPG2 plugin through wordPress admin UI by entering WPG2 UI.

14. If the .htaccess that was written to resides in the WordPress root and WordPress will need some rewite rules, then follow the procedures through the WP Admin UI -> Options -> Permalinks. That will write to the same .htaccess file and it's NOT supposed to overwrite your G2 rules just created #6 - #10 above. The G2 rules should be above the WordPress rules in the newly edited .htaccess.

Here's my final .htaccess file:

#################################

# BEGIN Url Rewrite section
# (Automatically generated. Do not edit this section)

<IfModule>
RewriteEngine On
RewriteBase /http://www.CreativeCrib.com/wordpress/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
RewriteCond %{REQUEST_URI} !/http://www.CreativeCrib.com/wordpress/wp-gallery2\.php$
RewriteRule . - [L]
RewriteCond %{THE_REQUEST} \ /http://www.CreativeCrib.com/wordpress/d/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/http://www.CreativeCrib.com/wordpress/wp-gallery2\.php$
RewriteRule . /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3
[QSA,L]
RewriteCond %{THE_REQUEST} \ /http://www.CreativeCrib.com/wordpress/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/http://www.CreativeCrib.com/wordpress/wp-gallery2\.php$
RewriteRule . /http://www.CreativeCrib.com/wordpress/wp-gallery2.php?g2_view=core.ShowItem&g2_path=%1 [Q
SA,L]
</IfModule>

# END Url Rewrite section

# BEGIN Url Rewrite section
# (Automatically generated. Do not edit this section)

<IfModule>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
RewriteCond %{REQUEST_URI} !/wordpress/wp-gallery2\.php$
RewriteRule . - [L]
RewriteCond %{THE_REQUEST} \ /wordpress/d/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/wordpress/wp-gallery2\.php$
RewriteRule . /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3
[QSA,L]
RewriteCond %{THE_REQUEST} \ /wordpress/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/wordpress/wp-gallery2\.php$
RewriteRule . /wordpress/wp-gallery2.php?g2_view=core.ShowItem&g2_path=%1 [QSA,L]
</IfModule>

# END Url Rewrite section

# BEGIN WordPress

<IfModule>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

#########################

It appears some rules are duplicates, though it works fine for me?

Hope this helps some folks.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-11-11 17:27

dpaule

thanks for writing this up.
this isn't the right place for docs though. users will search for it at:

http://wpg2.galleryembedded.com/index.php/WPG2:Plug-in_Gallery2_URL_Rewrites

could you please merge your docs into that page?

thanks!