acegames Posted May 7, 2009 Share Posted May 7, 2009 I have made my urls friendly with modrewrite but I am stuck on the last part My code is displaying : Download-DJ+Webstar+Feat+Jim+Jones+Dancing+On+Me-mp3-12525-/mp3.php?start=10-10.htm But needs to be like this to work : Download-DJ+Webstar+Feat+Jim+Jones+Dancing+On+Me-mp3-12525-/mp3.php-10.htm My htaccess : Options +FollowSymLinks RewriteEngine on RewriteRule Download-(.*)-(.*)-(.*)-(.*)-(.*)\.htm$ download-url.php?filename=$1&table=$2&id=$3&page=$4?start=$5 My page code : <a href="Download-<?php echo $uListName ?>-<?php echo $table ?>-<?php echo $fileID ?>-<?php echo $page ?>-<?php echo $start ?>.htm"><?php echo $ListName ?><br /></a> <? $i++; } if($numrows > ($start + 10)) { echo "<a href=\"" . $_SERVER[php_SELF] . "?start=" . ($start + 10) . "\">Next Page</a><br/>\n"; } else { echo ""; } if($start > 0) { echo "<a href=\"" . $_SERVER[php_SELF] . "?start=" . ($start - 10) . "\">Previous Page</a><br/>\n"; } else { echo ""; } echo"</p>"; ?> Could somebody please give me any pointers as to where I have gone wrong It all works apart from when I click on next page and then the url is $start=10 Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/ Share on other sites More sharing options...
acegames Posted May 7, 2009 Author Share Posted May 7, 2009 Just to add , the $page= which is giving me the problems I am getting like this : $page = ($_SERVER['REQUEST_URI']); Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/#findComment-828405 Share on other sites More sharing options...
acegames Posted May 7, 2009 Author Share Posted May 7, 2009 I now have it working , I changed :$page = ($_SERVER['REQUEST_URI']); to:$page = "mp3.php"; Is there a way to get the page name without the $start= on the end ? Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/#findComment-828416 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 If it's the same name as the page itself, then do this - $_SERVER['SCRIPT_URL']; Otherwise, no. Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/#findComment-828449 Share on other sites More sharing options...
acegames Posted May 7, 2009 Author Share Posted May 7, 2009 Thanks for your reply I have made some changes and it is all working now except on my download page I echo the $page as a back link and it is using the url in the browser for some reason with the $page variable on the end This is how im trying to display it : <div class="header"><a href="<?php echo"$page" ?>">Back</a></div> But its linking to :http://www.domain.com/Download/Lady+Gaga+Paparazzi/mp3/12526/mp3-testing.php/mp3-testing.php?start=10 Instead of to :http://www.domain.com/mp3-testing.php?start=10 If I just echo the $page variable I get : mp3-testing.php?start=10 Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/#findComment-828532 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Put a / before it. Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/#findComment-828540 Share on other sites More sharing options...
acegames Posted May 7, 2009 Author Share Posted May 7, 2009 thanks , that worked Link to comment https://forums.phpfreaks.com/topic/157223-solved-pagination-and-modrewrite-problem/#findComment-828544 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.