RewriteRule in URL for search engine with pagination

funque

Newbie
Joined
Dec 27, 2013
Messages
21
Reaction score
1
I have Htaccess file and pagination search engine, it is my search engine forms
Code:
<form class='fright' method='get' action='hasil_cari=' onsubmit="return false;">

      <input class='srcText' style='padding:6px;'type='text' name='keyword'>
      <input class='submit' style='padding:5;' type='submit' value='find' onclick="window.location.href=this.form.action + this.form.keyword.value;">

</form>
this is my RewriteRule to original url:
Code:
RewriteRule ^admin/keyword=(.*)-page=(.*)$ admin/index.php?h=home&m=find&keyword=$1&p=$2 [L]

in the address bar of my browser:
localhost/project/admin/keyword=....-page=2

then I click on page 2, but '-page=2' is read as a keyword, so the error message that I have created appear

"cannot find data = .....-page2"

anyone can solve this problem?
 
You are using greedy matches, you are basically saying: match any character and match them all!
So your url part "-page=2" gets selected, too.
Try using something like this:
Code:
admin/keyword=([^-]+)-page...
It excludes the - from the first part. If your keywords could contain a minus, you'd have to change it further, like this:
Code:
^admin/keyword=([(?!-page)]+)-page...
 
Back
Top