Passing & appending querystrings
8 posts
• Page 1 of 1
Passing & appending querystrings
Hi,
I'm trying to set up a Redirect Rule that forwards to a current search results page with a new QueryString appended to allow the page to know to operate the search in a different way.
So forward searchtwo.asp?query=blah to search-result.asp?searchtype=tag&query=blah
I had thought this would be :
RewriteRule ^searchtwo\.asp search-result.asp?searchtype=tag [QSA]
I can't get it to pass the appended tag querystring (searchtype), although if I add the additional querystring to the original page (searchtwo.asp) then this does load the redirect page fine.
This would be a better way of doing it, but again I've had no luck managing to get it to work:
/searchtwo/blah to search-result.asp?searchtype=tag&query=blah
Any help you could give would be appreciated.
Thanks,
Rick
I'm trying to set up a Redirect Rule that forwards to a current search results page with a new QueryString appended to allow the page to know to operate the search in a different way.
So forward searchtwo.asp?query=blah to search-result.asp?searchtype=tag&query=blah
I had thought this would be :
RewriteRule ^searchtwo\.asp search-result.asp?searchtype=tag [QSA]
I can't get it to pass the appended tag querystring (searchtype), although if I add the additional querystring to the original page (searchtwo.asp) then this does load the redirect page fine.
This would be a better way of doing it, but again I've had no luck managing to get it to work:
/searchtwo/blah to search-result.asp?searchtype=tag&query=blah
Any help you could give would be appreciated.
Thanks,
Rick
Re: Passing & appending querystrings
Hello, Rick
"This would be a better way of doing it, but again I've had no luck managing to get it to work:
/searchtwo/blah to search-result.asp?searchtype=tag&query=blah"
Please try the following rule for that:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^searchtwo/(.+)$ /search-result.asp?searchtype=tag&query=$1 [NC,L]
If it doesn't work, please enable logging in httpd.conf by putting
RewriteLogLevel 9
And provide rewrite.log records for the test request.
"This would be a better way of doing it, but again I've had no luck managing to get it to work:
/searchtwo/blah to search-result.asp?searchtype=tag&query=blah"
Please try the following rule for that:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^searchtwo/(.+)$ /search-result.asp?searchtype=tag&query=$1 [NC,L]
If it doesn't work, please enable logging in httpd.conf by putting
RewriteLogLevel 9
And provide rewrite.log records for the test request.
Re: Passing & appending querystrings
Hi Anton,
That still isn't working correctly, log files are below.
On the last line I think it's trying to apply that pattern to another file as well ?
Thanks,
Rick
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (2) init rewrite engine with requested uri /searchtwo/rose
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (1) Htaccess process request c:\inetpub\wwwroot\XXXXXX.com\.htaccess
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (3) applying pattern '^searchtwo/(.+)$' to uri 'searchtwo/rose'
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (4) RewriteCond: input='C:\Inetpub\wwwroot\XXXXXX.com\searchtwo\rose' pattern='!!-f' => matched
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (4) RewriteCond: input='C:\Inetpub\wwwroot\XXXXXX.com\searchtwo\rose' pattern='!!-d' => matched
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (1) Rewrite URL to >> /search-result.asp?search=rose&tag=yes
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (2) rewrite 'searchtwo/rose' -> '/search-result.asp?search=rose&tag=yes'
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (2) internal redirect with /search-result.asp?search=rose&tag=yes [INTERNAL REDIRECT]
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (2) init rewrite engine with requested uri /search-xml.asp?tag_query=&search_query=&productsize=&price_low=&price_high=
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (1) Htaccess process request c:\inetpub\wwwroot\XXXXXX.com\.htaccess
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (3) applying pattern '^searchtwo/(.+)$' to uri 'search-xml.asp'
That still isn't working correctly, log files are below.
On the last line I think it's trying to apply that pattern to another file as well ?
Thanks,
Rick
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (2) init rewrite engine with requested uri /searchtwo/rose
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (1) Htaccess process request c:\inetpub\wwwroot\XXXXXX.com\.htaccess
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (3) applying pattern '^searchtwo/(.+)$' to uri 'searchtwo/rose'
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (4) RewriteCond: input='C:\Inetpub\wwwroot\XXXXXX.com\searchtwo\rose' pattern='!!-f' => matched
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (4) RewriteCond: input='C:\Inetpub\wwwroot\XXXXXX.com\searchtwo\rose' pattern='!!-d' => matched
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (1) Rewrite URL to >> /search-result.asp?search=rose&tag=yes
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (2) rewrite 'searchtwo/rose' -> '/search-result.asp?search=rose&tag=yes'
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20193808/initial] (2) internal redirect with /search-result.asp?search=rose&tag=yes [INTERNAL REDIRECT]
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (2) init rewrite engine with requested uri /search-xml.asp?tag_query=&search_query=&productsize=&price_low=&price_high=
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (1) Htaccess process request c:\inetpub\wwwroot\XXXXXX.com\.htaccess
192.168.1.198 192.168.1.198 Wed, 17-Jul-2013 12:18:07 GMT [XXXXXX.com/sid#1895803666][rid#20199728/initial] (3) applying pattern '^searchtwo/(.+)$' to uri 'search-xml.asp'
Re: Passing & appending querystrings
So, it rewrites
/searchtwo/rose
to
/search-result.asp?search=rose&tag=yes
Is that the desired result? If not, what it should be?
/searchtwo/rose
to
/search-result.asp?search=rose&tag=yes
Is that the desired result? If not, what it should be?
Re: Passing & appending querystrings
Hi Anton,
I agree that it appears to be passing the querystring correctly, however the page (search-result.asp) does not show the same content for:
searchtwo/rose as it does for search-result.asp?search=rose&tag=yes
there are no search results on searchtwo/rose
and 2 search results with search-result.asp?search=rose&tag=yes
This may be because of some of the AJAX running the search ? Am I right in thinking it really shouldn't make any difference to ISAPI Rewrite ?
Thanks,
Rick
I agree that it appears to be passing the querystring correctly, however the page (search-result.asp) does not show the same content for:
searchtwo/rose as it does for search-result.asp?search=rose&tag=yes
there are no search results on searchtwo/rose
and 2 search results with search-result.asp?search=rose&tag=yes
This may be because of some of the AJAX running the search ? Am I right in thinking it really shouldn't make any difference to ISAPI Rewrite ?
Thanks,
Rick
Re: Passing & appending querystrings
Hello, Rick
It's actually not quite clear why you want to make search queries SEO friendly. Usually it's senseless.
Can you clarify?
It's actually not quite clear why you want to make search queries SEO friendly. Usually it's senseless.
Can you clarify?
Re: Passing & appending querystrings
Hi Anton,
These are tags/categories rather than just a search page so it would be useeful to have them displayed in a user friendly way muchlike Wordpress does.
Thanks,
Rick
These are tags/categories rather than just a search page so it would be useeful to have them displayed in a user friendly way muchlike Wordpress does.
Thanks,
Rick
Re: Passing & appending querystrings
Hello, Rick
Ok, I see...
AJAX is definitely not a problem.
Please make sure you don't have ISAPI_Rewrite registered twice - on server and site level, if you are on IIS6.
And also tell if any other rules are working fine for you.
Ok, I see...
AJAX is definitely not a problem.
Please make sure you don't have ISAPI_Rewrite registered twice - on server and site level, if you are on IIS6.
And also tell if any other rules are working fine for you.
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 13 guests