axew3.com

WP_w3all .htaccess and Javascript for phpBB: rewrite URLs to point iframe how to (Spiders friendly)

by

Open .htaccess file of your phpBB root folder, search for this line:

RewriteRule ^(.*)$ app.php [QSA,L]

just below add the follow:

#p reserved in WP
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true&)(.*)(p=)([0-9]+)(.*)?$
RewriteRule . /yourwp/index.php/forum/?%3post_id=%5%6 [R,L]
#all others
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true)(.*)$
RewriteRule . /yourwp/index.php/forum/?%3 [R,L]

Change on lines

RewriteRule . /yourwp/index.php/forum/?%3post_id=%5%6 [R,L]

and

RewriteRule . /yourwp/index.php/forum/?%3 [R,L]

the relative iframe URL that need to point to your correct WP forum page (leave index.php in place).

To help understand, this is the correct .htaccess code for this online working example:

WP page forum URL (that contain and display the iframe in this case): https://www.axew3.com/w3/forum/

Resulting .htaccess code based on this will be:

#p reserved in WP
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true&)(.*)(p=)([0-9]+)(.*)?$
RewriteRule . /w3/index.php/forum/?%3post_id=%5%6 [R,L]
#all others
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true)(.*)$
RewriteRule . /w3/index.php/forum/?%3 [R,L]

 

To complete the redirect flow to the iframe phpBB, embedded into WP page, for phpBB email notification messages links to point to iframe follow also with these two steps (get ready files for phpBB 3.2 on bottom of this page):

For email notification links that you want to redirect to iframe forum page of WP, assuming we point to three main behaviors we are interested in, which are for example PM notifications, New posts and Topics on forum, we need to change so 3 phpBB files in this way:

open folder  your-phpBB/phpBB/notification/type

on this folder, as working example, we go to open and so modify the following files:

pm.php, post.php, topic.php

on each file, you’ll find very similar code like this (in pm.php there is only one to change, on topic.php and post.php there are 4 or 5. Do not apply this edit to the last one string on post.php and topic.php):

'U_VIEW_MESSAGE' => generate_board_url() . '/ucp.' . $this->php_ext . "?i=pm&mode=view&p={$this->item_id}",

you should change these urls, adding iframe=true& on each line, exactly after the ? char, like this:

'U_VIEW_MESSAGE' => generate_board_url() . '/ucp.' . $this->php_ext . "?iframe=true&i=pm&mode=view&p={$this->item_id}",

Ready files for phpBB 3.2 zip:
notification-pm-post-topic-x_phpbb32_ready