In another issue mike15 was asking for a chance to redirect users from standalone G2 back to Drupal for login/logout and for making changes to the account details. I'm creating a new issue for it as it needs further discussion and is somewhat misplaced (=unrelated) to the original issue. Here is what he wrote ...
... I am curious if you have seen the phpbb module implementation for Drupal?
They have similar integration where phpbb forum is located outside the Drupal root directory and so they utilize .htaccess script provided to redirect users back to Drupal for login/logout and couple of other things...
Take a look at the following sample:
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
# RewriteBase /
RewriteRule ^quote_(.*)$ posting.php?mode=quote&p=$1 [L]
RewriteRule ^postnew_forum_(.*)$ posting.php?mode=newtopic&f=$1 [L]
RewriteRule ^replyto_topic_(.*)$ posting.php?mode=reply&t=$1 [L]
RewriteRule ^search_newposts$ search.php?search_id=newposts [L]
RewriteRule ^search_ego$ search.php?search_id=egosearch [L]
RewriteRule ^unwatch_topic_(.*)$ viewtopic.php?unwatch=topic&t=$1 [L]
RewriteCond %{QUERY_STRING} ^mode=viewprofile&u=(.*)$
RewriteRule ^profile.php(.*)$ ../user/%1 [L]
RewriteCond %{QUERY_STRING} ^mode=editprofile(.*)$
RewriteRule ^profile.php(.*)$ ../user [L]
RewriteCond %{QUERY_STRING} ^mode=register(.*)$
RewriteRule ^profile.php(.*)$ ../user/register [L]
RewriteCond %{QUERY_STRING} ^logout=true(.*)$
RewriteRule ^login.php(.*)$ ../index.php?q=logout [L]
RewriteCond %{QUERY_STRING} ^redirect=posting.php&mode=newtopic&f=(.*)$
RewriteRule ^login.php(.*)$ ../user/login?destination=forum/postnew_forum_%1 [L]
RewriteCond %{QUERY_STRING} ^redirect=posting.php&mode=reply&t=(.*)$
RewriteRule ^login.php(.*)$ ../user/login?destination=forum/replyto_topic_%1 [L]
RewriteCond %{QUERY_STRING} ^redirect=posting.php&mode=quote&p=(.*)$
RewriteRule ^login.php(.*)$ ../user/login?destination=forum/quote_%1 [L]
RewriteCond %{QUERY_STRING} ^redirect=search.php&search_id=newposts(.*)$
RewriteRule ^login.php(.*)$ ../user/login?destination=forum/search_newposts [L]
RewriteCond %{QUERY_STRING} ^redirect=search.php&search_id=egosearch(.*)$
RewriteRule ^login.php(.*)$ ../user/login?destination=forum/search_ego [L]
RewriteCond %{QUERY_STRING} ^redirect=viewtopic.php&t=(.*)&unwatch=topic$
RewriteRule ^login.php(.*)$ /user/login?destination=forum/unwatch_topic_%1 [L]
RewriteCond %{HTTP_REFERER} !^(.*)redirect=admin/index\.php(.*)$ [NC]
RewriteCond %{QUERY_STRING} !^(.*)redirect=admin/index\.php(.*)$ [NC]
RewriteRule ^login.php(.*)$ ../user/login?destination=forum [L]
RewriteCond %{QUERY_STRING} ^mode=post&u=(.*)$
RewriteRule ^privmsg.php(.*)$ ../privatemsg/msgto/%1 [L]
RewriteCond %{QUERY_STRING} ^folder(.*)$
RewriteRule ^privmsg.php(.*)$ ../privatemsg [L]