Hi there, I'm using getPage on a blog page with friendly URLs, based on some other threads in this forum. The only problem is that on pages with a number above 9, only the first digit gets through. So when I'm on page 11, modx shows page 1. When I'm on page 23, I get page 2. And so on. The url that is generated is correct though.
This is the friendly url plugin (onWebPagePreRender):
$id = $modx->resource->get('id');
if ($id == '2') {
$output = $modx->resource->_output;
$output = preg_replace('%/(.+?)\?page=([0-9]+)%mis', '/$1/page-$2', $output);
// don't show page-1 on page 1
$output = preg_replace('%/(.+?)/page-1/%mis','/$1', $output);
$modx->resource->_output = $output;
}
And this is the htaccess code (placed above 'the friendly urls part'):
# friendly pagination urls
RewriteCond %{REQUEST_URI} /(.+?)/page-(.+?) [NC]
RewriteRule (.*) /%1?page=%2 [L,QSA,NC]
It must be something simple, I just can't get it to work for pages with a number above 9. I hope someone can spot my mistake!