by HowNow » 19 Sep 2017, 20:30
PhpBB is used solely to drive forum discussions which may span several pages per topic. For proper indexing by search engines, each web page must be unique. For pages that span more than one, standard SEO practice demands that each page is uniquely identified to avoid penalties of duplicate content, duplicate meta tags or header or meta descriptions. The best way to do this is through the use of header section pagination with rel="next" and rel="prev".
This tutorial will highlight how to achieve header pagination with rel="next" and rel="prev" in standard PhpBB installation.


1. Open

Code: Select all

to edit it.

2. Add this: inn the header section:

Code: Select all

<!-- IF PREVIOUS_PAGE --><link rel="prev" href="{PREVIOUS_PAGE}" /><!-- ENDIF -->
<!-- IF NEXT_PAGE --><link rel="next" href="{NEXT_PAGE}" /><!-- ENDIF -->
Before the </header> code.

3. However, when on oage 2, the function also produces a ...&start=0 link when pointing back to page 1, and Google might see that as different site again to the page 1 link without that parameter.
To solve this, open

Code: Select all

and find:

Code: Select all

        $tpl_prefix . 'PREVIOUS_PAGE'    => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page), 
Then replace with:

Code: Select all

        //$tpl_prefix . 'PREVIOUS_PAGE'    => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page),
        $tpl_prefix . 'PREVIOUS_PAGE'=> $on_page== 1? '': $base_url. ( ( $on_page- 2 )* $per_page> 0? "{$url_delim}start=". ( ( $on_page- 2 )* $per_page ): '' ),  
In effect, the rel="prev" URL on a second page pointing back to page 1 won't get assigned a start parameter anymore. That code change will take away the &start=0 from URLs pointing to the first page in a topic, hence better indexing.

For users of Custom url rewrite mods, the change may be a little bit complex.

Good luck.