0

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?

Zaffar Saffee
  • 6,167
  • 5
  • 39
  • 77

2 Answers2

1

@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$
max
  • 3,614
  • 9
  • 59
  • 107
0

Found this post on removing the query string from URLs using .htaccess directives: http://briancray.com/2010/03/18/htaccess-hack-remove-url-query-strings/

and

mod_rewrite: remove query string from URL?

and

http://www.webmasterworld.com/apache/4171357.htm

HTH, Victor

Community
  • 1
  • 1
Victor Nițu
  • 1,485
  • 13
  • 18