Forum Moderators: phranque
I thought of using mod-rewrite but I guessed that that's only for rewriting the host/filename stuff.... but then I found:
When you want to erase an existing query string, end the substitution string with just the question mark.
So I tried the following but alas to no avail:
RewriteCond %{QUERY_STRING} ^gad=foo
RewriteRule (.*) http://%{HTTP_HOST}/$1/? [R=302,L] Two questions:
1) is this possible (and where's my mistake - the 302's meant to be inoccuous and the L is there so it loops); and
2) perhaps more importantly - by stripping off the string will I ever see it in the logs (I was hoping that it would show up in the first pass and then disappear for the display and then the remainder of the logs).
I do not (yet) have my own weblog software so I was simply going to use Grep for windows to get an idea of adwords traffic.
I guess therefore - the fourth of my two questions (!) is - any better ideas for a simple analysis of adwords (but then I guess that's another forum). I'm still curious about my mod-rewrite problem though :)
The code you posted should work. But I seem to recall running into problems when trying to use server variables in the substitution in .htaccess. Try this slight modification to see if that's the problem:
RewriteCond %{QUERY_STRING} ^gad=foo
RewriteCond %{HTTP_HOST} ^(.*)$
RewriteRule ^(.*)$ http://%1/$1/? [R=302,L]
Thanks - actually it did work (sort of) - must've been a caching hiccup of some sort.
It put an extra slash on the end though so:
RewriteCond %{QUERY_STRING} ^gad=foo
RewriteRule (.*) http://%{HTTP_HOST}/$1? [R=302,L]