.htaccess mod_rewrite - limit to root directory
How to apply a rule only to the root directory (where it's placed)?
How about putting:
RewriteCond %{REQUEST_URI} /([^/]*)
before any of your rules. That will match on any number of characters that are not a slash.
I would use the following
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/[^/]*(\?.*)?$
# your rewrite code here
精彩评论