Pagination mod rewrite help

Hi all can someone please help me out in trying to get clean URL for my pagination setup

here is the actual pagination code:

If($page > 1) {


For($i = 1 ; $i <= $NumberOfPages ; $i++) {
If($i == $page) {
$Nav .= "<B>$i</B>";


$Nav .= "<class='pagination'><A HREF=\\"results.php?page="   . $i . "&search=" .urlencode($search) . "\\">$i</A>";


        If($page < $NumberOfPages) {

$Nav .= "<class='pagination'><A HREF=\\"results.php?page=" . ($page+1) . "&search=" .urlencode($search) . "\\">Next >></A>";


Echo "<BR><BR>" . $Nav;
echo "</div>";
echo "</div>";


This is how I would like my “current” pagination looks when I try to search

this is how I would like my URL to be

or similar



The FIRST step in creating mod_rewrite code is to be able to state (words) what you have in the “new format” URI and how that will be “translated” by mod_rewrite to the “old (serve-able) format.” When you do that, you should be able to see any potential pitfall (like other .html files which may be “translated,” too). Once you can “speak the spec,” creating the code becomes trivial.



What have you tried yourself? If nothing please read the following article to get a basic introduction to mod_rewrite:

If you have any questions feel free to come back here to ask them :slight_smile: