Reputation: 541
i want to redirect only this url http://domain.com/?eID=dd_googlesitemap
to http://domain.com/test.html
my rule is
RewriteRule http://domain.com/?eID=dd_googlesitemap http://domain.com/test.html [R=301,L]
but it doesnt work. I dont get it. Any ideas whats wrong?
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Upvotes: 0
Views: 47
Reputation: 7074
The problem you're getting is that query strings and domains aren't matched by a RewriteRule. Instead you would need to specify these as conditions prior to the rule, using RewriteCond
:
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteCond %{QUERY_STRING} ^eID=dd_googlesitemap$
RewriteRule ^$ http://domain.com/test.html? [R=301,L]
If you don't specify any [flags]
on the RewriteCond's, then they are AND'd, so here the domain part of the requested URL (the HTTP_HOST) must be "domain.com"... "www.domain.com" will not be matched. Also, if any other options are exist in the query string, it won't match.
Finally, we rewrite a completely empty request (no additional paths, etc), to the new URL. Adding ?
to the end of the URL stops the query string being added.
Upvotes: 1