官网上在讲到RewriteRule有这么一段话: What is matched? The Pattern will initially be matched against the part of the URL after the hostname and port, and before the query string. If you wish to match against the hostname, port, or query string, use a RewriteCond with the %{HTTP_HOST}, %{SERVER_PORT}, or %{QUERY_STRING} variables respectively. 主要意思是:定义的样式只匹配url的主机名和端口之后,查询字串前的部分,如果想要匹配主机名,端口,查询字串, 就要使用RewriteCond结合如下变量%{HTTP_HOST},%{SERVER_PORT}, %{QUERY_STRING}.