title: mod_rewrite rules for my site
body: <p>I have these rules on my site:</p>
  
  <pre><code>RewriteCond $1 !^(support|about-us|profile|support|features|videos|terms-of-service|about-us|signup|media|includes|modules|cgi-bin|templates|xmlrpc|language|libraries|plugins|administrator|component|images|dev|data)
  RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([a-z0-9\-]+)/[^\ ]*\ HTTP/
  RewriteCond %{DOCUMENT_ROOT}/$1 -d
  RewriteRule ^([a-z0-9\-]+)/(.*)$ https://$1.example.com/$2 [R=301,L]
  </code></pre>
  
  <p>#</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.example\.com
  RewriteCond %1 !^www\.
  RewriteRule ^(support|about-us|profile|support|features|newserver|videos|about-us|terms-of-service|signup|component|includes|media|cgi-bin|templates|xmlrpc|language|modules|libraries|plugins|administrator|images(/.*))$ https://example.com/$1 [R=301,L]
  
   # Externally redirect all www hostnames to non-www hostnames
   RewriteCond %{HTTP_HOST} ^(([a-z0-9\-]+\.)*)www\.(([a-z0-9\-]+\.)*)example\.com
   RewriteRule ^(.*)$ https://%1%3example.com/$1 [R=301,L]
  </code></pre>
  
  <p>I added these below to redirect these types: <a href="https://example.com/firstnamelastname?mv=0" rel="nofollow">https://example.com/firstnamelastname?mv=0</a> etc</p>
  
  <pre><code> RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
   RewriteCond %{QUERY_STRING} ^mv=[0-4]$
   RewriteRule ^([A-Za-z0-9]+)$ https://$1.example.com/? [L,R]
  </code></pre>
  
  <p>However I cannot get these to redirect <a href="https://example.com/firstnamelastname" rel="nofollow">https://example.com/firstnamelastname</a></p>
  
  <p>If i remove the Query string from the last 3 lines then If i would click on features link on my website It would redirect to <a href="https://features.example.com" rel="nofollow">https://features.example.com</a> which is what the rules at the top are preventing. </p>
  
  <p>Can anyone assist with this.</p>