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$
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
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.