I am stuck now, here below is a snip from my paging code, this is the part the builds the URL for the paging links, it worked really great until now because now I am changi
This will do the trick
$uri = $_SERVER['REQUEST_URI'];
$uri = preg_replace('#page/\d+/*#', '', $uri); // remove page from uri
$uri = preg_replace('#/$#', '', $uri); // remove trailing slash
$selfurl = $uri . '/page/';
$page = $_GET['page'];
if ($page) {
$start = ($page - 1) * $items_per_page;
} else {
$start = 0;
}
if ($page == 0) {
$page = 1;
}
What the code is doing here is removing the /page/2 part from the uri if it exists and then you can modify the code as you want.
You mentioned that the code works if /page/1 part is not in the URI so removing that part if it exists should work too.