Forum Moderators: phranque

Message Too Old, No Replies

url redirect for searching at link page

url redirect for searching at link page

         

dwikristianto

7:32 pm on Apr 17, 2007 (gmt 0)

10+ Year Member



hi all,

i'm new in this forum.
i have little problem that i can not solve.

i have links database page. This page have pagination, result per page, and keyword searching feature.

i use this rule in htaccess for pagination
RewriteEngine On
RewriteOptions inherit
RewriteRule ^index-([0-9]*).* /index.php?currpage=$1 [L]

after applying that rule, i can search and change result per page.
how can i add search and result per page to the current rewrite rule?

TIA for any respons,
dwi

jdMorgan

10:20 pm on Apr 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you already have the 'search' and 'results-per-page' parameters in a query string, such as "/index-123?action=search&resperpag=12" then you may just need to add the [QSA] flag to your rule (use [QSA,L]). The [QSA] flag causes your new query name/value pair to be appended to the existing query string, rather than replacing it. See the mod_rewrite documentation [httpd.apache.org] for more info.

Otherwise, we need to know what your 'search' and 'results-per-page' URLs look like, and what the corresponding call to the script should look like. If the 'search' and 'results per page' information is not carried in the URL itself, then we need to know where this information is.

Jim

dwikristianto

12:14 pm on Apr 20, 2007 (gmt 0)

10+ Year Member



dear jdMorgan,

thank you for the reply. i almost give up on this, because so many problems come up and down.

btw, i'll try the qsa.

the 'result-per-page' and 'search' query come from user input at a form.

regards,
dwi

dwikristianto

12:18 pm on Apr 20, 2007 (gmt 0)

10+ Year Member



dear all,
(addition)

the url will be like "/index-123?search=findme&perpage=12"

123 = the page number
findme = findphrase typed by user
perpage = how many row per page

regards,
dwi

jdMorgan

12:39 pm on Apr 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

RewriteRule ^index-([0-9]*)$ /index.php?currpage=$1 [b][QSA,L][/b]

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim