简体   繁体   中英

Hiding offset in pagination

i have following url structure

http://www.mydomain.com/vpn-offers-p3.html

this page should be redirect to

http://www.mydomain.com/vpn-offers.php?st=60&page=3

here st is offset for the pagination and will be varying with page, while page is the current page number

i am trying to generate the url in this way

<? if($st<$total-$rw){?><a href="<?
 echo "http://www.mydomain.com/vpn-providers-p";?><? echo$offset=$st+$rw."-".$pagenext=$page+1 ;?> class="nextprev">Next</a>

note that it will show offset value too in link

i have established following .htaccess' rule so for

R`ewriteRule ^vpn-providers-p([^-]*)\.html$ /vpn-providers.php?st=(.*)&page=$1 [L]`

if you pay a little attention, you will see that first url is not passing value of offset

can somebody tell me how i can hide offset variable in URL? while i need the page to be redirected corectly?

@victor he wants to hide the query string not to remove it

there is no such thing as hiding variable in url ! it should appear in the url one way or another

anyway if it's really necessary you probably can use cookie and javascript to store the new variable before redirecting user to new page or in this case you can find out offset without passing it on the url

   offset =  current page -1 * per page 

and it's better to change

^vpn-providers-p([^-]*)\.html$
to
^vpn-providers-p([0-9]*)\.html$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM