Preserve query on url re-write
3 posts
• Page 1 of 1
Preserve query on url re-write
Hi,
Can anyone help me create a rule to preserve query values on a re-written url?
I have a search form that when someone performs a search it gets posted to
/default.asp?pn=search
using this rule:
RewriteRule ^search$ /default.asp?pn=search [NC,L]
How can I set up the rule to preserve the following as a querystring
e.g. /search?zoom_query=elgar&zoom_page=2&zoom_per_page=10
I want to be re-written as:
/default.asp?pn=search&zoom_query=elgar&zoom_page=2&zoom_per_page=10
I have tried this:
RewriteCond %{QUERY_STRING} ^zoom_query=([^&]+)$
RewriteRule ^default\.asp$ /default.asp?pn=search$1
but it didn't work
Many thanks
Can anyone help me create a rule to preserve query values on a re-written url?
I have a search form that when someone performs a search it gets posted to
/default.asp?pn=search
using this rule:
RewriteRule ^search$ /default.asp?pn=search [NC,L]
How can I set up the rule to preserve the following as a querystring
e.g. /search?zoom_query=elgar&zoom_page=2&zoom_per_page=10
I want to be re-written as:
/default.asp?pn=search&zoom_query=elgar&zoom_page=2&zoom_per_page=10
I have tried this:
RewriteCond %{QUERY_STRING} ^zoom_query=([^&]+)$
RewriteRule ^default\.asp$ /default.asp?pn=search$1
but it didn't work
Many thanks
Re: Preserve query on url re-write
I think my problem is in the regex
In the log files I found this:
RewriteCond: input='zoom_query=elgar&zoom_cat[]=22&zoom_per_page=10&zoom_and=1&zoom_sort=0' pattern='^zoom_query=([^&]+)$' => not-matched
I'm not very good at understanding the regex patterns.
Can anyone help me construct a regex that will match all querystring parameters?
Many thanks.
In the log files I found this:
RewriteCond: input='zoom_query=elgar&zoom_cat[]=22&zoom_per_page=10&zoom_and=1&zoom_sort=0' pattern='^zoom_query=([^&]+)$' => not-matched
I'm not very good at understanding the regex patterns.
Can anyone help me construct a regex that will match all querystring parameters?
Many thanks.
Re: Preserve query on url re-write
I think I fixed it - if anyone is interested.
However this may not be the ideal solution, but it works for me.
RewriteCond %{QUERY_STRING} ^zoom_query=([^~]+)$ [NC]
RewriteRule ^search$ /default.asp?pn=search&zoom_query=%1 [NC,L]
However this may not be the ideal solution, but it works for me.
RewriteCond %{QUERY_STRING} ^zoom_query=([^~]+)$ [NC]
RewriteRule ^search$ /default.asp?pn=search&zoom_query=%1 [NC,L]
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 20 guests