1. RewriteRule cannot "see" query strings; it examines only the requested URL-path. Use a RewriteCond.
2. The literal periods in the pattern to match your subdomain must be escaped as shown.
3. The subdomain pattern should not be end-anchored in case it is requested as an FQDN or with a port number appended. in either case, this would cause an end-anchored pattern to fail.
4. This pattern should be case-insensitive for the same reason.
5. The RewriteCond testing the subdomain is only required if this .htaccess file is shared with other subdomains and/or your main domain.
6. No characters except for "$" and "%" in the RewriteRules
substitution need to be escaped.
7. A trailing "?" is required to remove the original query string. Otherwise, it is passed through the rule by default. This question mark functions as an operator, and *will not* appear in the redirected-to URL.
RewriteEngine on
#
# externally redirect subdomain.domain.com/?article to subdomain.domain.com/index.php
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com [NC]
RewriteCond %{QUERY_STRING} ^article$
RewriteRule ^$ http://subdomain.domain.com/? [R=301,L]
Jim
[edited by: jdMorgan at 4:50 am (utc) on Mar 18, 2011]