404 error on page numbers

phpBB3 SEO Mixed mod Rewrite support forum. This mods performs URL rewriting for phpBB3, injecting forums in their URLs and keeping a static rewriting for topics.

Moderator: Moderators

404 error on page numbers

Postby PTish » Sat Aug 07, 2010 3:12 pm

Hello,

When i am in a forum, seeing the list of all the topics. You see sometimes topics with page numbers. The point is, the page numbers ain't working. However in the topic itself, the page numbers are working. I noticed a small difference.

This is the url in the forum to the second page:
-http://url.com/forum_name/topic13.html&start=10

In the topic it self, this is the link to the second page:
-http://url.com/forum_name/topic13.html?start=10

See the difference? I have no idea where it is coming from. Anyone who can tell me what is wrong?
PTish
 
Posts: 5
Joined: Sat Aug 07, 2010 3:07 pm

Advertisement

Re: 404 error on page numbers

Postby PTish » Mon Aug 09, 2010 9:45 am

No one? :(
PTish
 
Posts: 5
Joined: Sat Aug 07, 2010 3:07 pm

Re: 404 error on page numbers

Postby PTish » Wed Aug 11, 2010 10:27 pm

With exactly the same files and the same settings, it's working local. But it shows a whole different link.
topic13-10.html

So how to solve this? Anyone?
PTish
 
Posts: 5
Joined: Sat Aug 07, 2010 3:07 pm

Re: 404 error on page numbers

Postby PTish » Wed Aug 11, 2010 11:20 pm

I checked the functions.php file and the functions_display.php file. The two files who generate the topic pagination. Both are correct. Exactly as they should be.

The problem is to be found in functions_display.php

Code: Select all
if (empty($pagin_find)) {
            $pagin_find = array('`(https?\://[a-z0-9_/\.-]+/[a-z0-9_\.-]+)(\.(?!' . $phpEx . ')[a-z0-9]+)(\?[\w\#$%&~\-;:=,@+\.]+)?(&|\?)start=([0-9]+)`i', '`(https?\://[a-z0-9_/\.-]+/[a-z0-9_\.-]+)/(\?[\w\#$%&~\-;:=,@+\.]+)?(&|\?)start=([0-9]+)`i' );
            $pagin_replace = array( '\1' . $phpbb_seo->seo_delim['start'] . '\5\2\3', '\1/' . $phpbb_seo->seo_static['pagination'] . '\4' . $phpbb_seo->seo_ext['pagination'] . '\2' );
         }
         $pagination = str_replace( '&start=0', '', $pagination );
         $pagination = preg_replace( $pagin_find, $pagin_replace, $pagination );


When i output $pagin_find, $pagin_replace and $pagination. only $pagination is different from eachother (local and remote).
Even $phpbb_seo->seo_delim['start'], $phpbb_seo->seo_static['pagination'] and $phpbb_seo->seo_ext['pagination'] result the same.

I hope someone is able to tell me with this information what goes wrong :(
PTish
 
Posts: 5
Joined: Sat Aug 07, 2010 3:07 pm

Re: 404 error on page numbers

Postby PTish » Sun Aug 22, 2010 7:26 pm

*sigh*
PTish
 
Posts: 5
Joined: Sat Aug 07, 2010 3:07 pm

Re: 404 error on page numbers

Postby Buster » Mon Oct 03, 2011 4:59 pm

Is there any news on this? I still have this problem with phpBB v3.0.9 and SEO v0.6.8.
Buster
 
Posts: 2
Joined: Mon Oct 03, 2011 2:53 pm

Re: 404 error on page numbers

Postby Buster » Mon Oct 03, 2011 6:33 pm

temporary fixed it with this code in function topic_generate_pagination($replies, $url) in includes/functions_display.php
Code: Select all
        // www.phpBB-SEO.com SEO TOOLKIT BEGIN
        if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
error_log(var_export($pagination,1));
            static $pagin_find = array();
            static $pagin_replace = array();
            if (empty($pagin_find)) {
                $pagin_find = array(
                    // http://example.com/a_n-y/d.i.r/with.ext
                    '`(https?\://[a-z0-9_/\.-]+/[a-z0-9_\.-]+)(\.[a-z0-9]+)(\?[\w$%&~\-;:=,@+\. ]+)?(#[a-z0-9_\.-]+)?(&|\?)start=([0-9]+)`i',
                    // http://example.com/a_n-y/d.i.r/withoutext
                    '`(https?\://[a-z0-9_/\.-]+/[a-z0-9_-]+)/?(\?[\w$%&~\-;:=,@+\. ]+)?(#[a-z0-9_\.-]+)?(&|\?)start=([0-9]+)`i',
                    // try to fix [url=http://www.phpbb-seo.com/en/mixed-seo-url/article7184.html]404 error on page numbers[/url]
                    '`(https?\://[a-z0-9_/\.-]+)/?(.*)\.html(#[a-z0-9_\.-]+)?&start=([0-9]+)`i',
                );
                $pagin_replace = array(
                    // http://example.com/a_n-y/d.i.r/with-xx.ext
                    '\1' . $phpbb_seo->seo_delim['start'] . '\6\2\3\4',
                    // http://example.com/a_n-y/d.i.r/withoutext/pagexx.html
                    '\1/' . $phpbb_seo->seo_static['pagination'] . '\5' . $phpbb_seo->seo_ext['pagination'] . '\2\3',
                    // try to fix [url=http://www.phpbb-seo.com/en/mixed-seo-url/article7184.html]404 error on page numbers[/url]
                    '\1\2-\4.html\3',
                );
            }
            // try to fix [url=http://www.phpbb-seo.com/en/mixed-seo-url/article7184.html]404 error on page numbers[/url]
            //$pagination = preg_replace( $pagin_find, $pagin_replace, $pagination );
            $count = 1;
            while($count > 0) {
                $pagination = preg_replace( $pagin_find, $pagin_replace, $pagination, -1, $count);
            }
        }
        // www.phpBB-SEO.com SEO TOOLKIT END

added a 3rd replacement for $pagination and loop though all urls in html string $pagination

But the real cause seems to be
- that in viewforum the parameter added to the url is &start=(number) instead of ?start=(number)
- preg_replace doesn't replace all occurances in $pagination, only the last one
Buster
 
Posts: 2
Joined: Mon Oct 03, 2011 2:53 pm


Return to Mixed SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 9 guests