I added the following .htaccess rule:-
RewriteRule ^widgets$ products.php?cat=20 [QSA]
So now I have a simple link called 'widgets' which leads to the 'widgets' category 1st page. However, the links to the 2nd page looks like the following:-
products.php?cat=20&pg=2
What I would like is for the subsequent pages to be rather in the form of:-
widgets?pg=2
The QSA flag in the above .htaccess rule does achieve this, but I need to change the function which generates these page links, otherwise the only way of getting to widgets?pg=2
is by typing it in the browser address bar as:- mywebsite.com/widgets?pg=2
.
I think the following PHP function might need to be adjusted, to achieve the result I want. Can any PHP wizards or anyone with appropriate knowledge please help with this. The reason I want to do this is because I want google to index the simple looking pages, rather than the longer ones:-
function writepagebar($CurPage,$iNumPages,$sprev,$snext,$sLink,$nofirstpage){
$startPage = max(1,round(floor((double)$CurPage/10.0)*10));
$endPage = min($iNumPages,round(floor((double)$CurPage/10.0)*10)+10);
if($CurPage > 1)
$sStr = $sLink . '1' . '" rel="prev"><span style="font-family:Verdana;font-weight:bold">«</span></a> ' . $sLink . ($CurPage-1) . '">'.$sprev.'</a> | ';
else
$sStr = '<span style="font-family:Verdana;font-weight:bold">«</span> '.$sprev.' | ';
for($i=$startPage;$i <= $endPage; $i++){
if($i==$CurPage)
$sStr .= '<span class="currpage">' . $i . '</span> | ';
else{
$sStr .= $sLink . $i . '">';
if($i==$startPage && $i > 1) $sStr .= '...';
$sStr .= $i;
if($i==$endPage && $i < $iNumPages) $sStr .= '...';
$sStr .= '</a> | ';
}
}
if($CurPage < $iNumPages)
$sStr .= $sLink . ($CurPage+1) . '" rel="next">'.$snext.'</a> ' . $sLink . $iNumPages . '"><span style="font-family:Verdana;font-weight:bold">»</span></a>';
else
$sStr .= ' '.$snext.' <span style="font-family:Verdana;font-weight:bold">»</span>';
if($nofirstpage) $sStr = str_replace(array('&pg=1"','?pg=1"'),'" rel="start"',$sStr);
return($sStr);
}
If it helps to know how the writepagebar function fits into the incproducts.php which itself sits inside the products.php page you can see here:-