Question

RewriteRule result/([^\.]+) /job/search/result?k=$1 [L]

i have this code working well with urls like this

www.example.com/job/search/result/keyword

will give me the result of "keyword"

but the problem is that cakephp paginator is generating a link like this

result/page:2?k=keyword

how can i write a rule for that to fix the problem, i tried this but without a luck

RewriteRule result\/page:([0-9]+)\?k=([^\.]+) /job/search/result/page:$1?k=$2   [L]

so my new rules are

RewriteRule result\/page:([0-9]+)\?k=([^\.]+) /job/search/result/page:$1?k=$2   [L]
RewriteRule result/([^\.]+) /job/search/result?k=$1 [L]
Was it helpful?

Solution

I've fixed it by adding a rewriting condition

RewriteCond %{REQUEST_URI} !^/job/search/result/page:

so that the rewrite rule will only respond to

/job/search/result/keyword
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top