If you want friendly URL for GetPage example:
mysite.ru/category/?page=2
mysite.ru/category/subpage/?page=2
mysite.ru/category/subpage/subsubpage/?page=2
to
mysite.ru/category/page-2/
mysite.ru/category/subpage/page-2/
mysite.ru/category/subpage/subsubpage/page-2/
It is necessary to make:
- Сreate Snippet And to include an event "OnWebPagePrerender"
- Add this code:
event->name === 'OnWebPagePrerender') {
$output = $modx->resource->_output;
$output = preg_replace('%(.+?)/\?page=(.+?)%mis', '$1/page-$2/', $output);
$modx->resource->_output = $output;
}
This code will change links
mysite.ru/category/?page=2
To
mysite.ru/category/page-2/
- Create web rules for nginx
- Add this code:
rewrite ^/(.+?)/page-(.*)$ /$1/?page=$2 last;
location / {
try_files $uri $uri/ @modx-rewrite;
}
Everything is ready