title: remove everything after comma in url and redirect in htaccess
body: <p>I'm trying to add some rewrite rules to my htaccess file and I'm having a bit of trouble with a few bits.</p>
  
  <p>I've currently got the following set up (bits are from different sites so I'm sorry if it's not consistent!):</p>
  
  <pre><code>RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /search\.php\?part=([^&amp;]+)\ HTTP/ 
  RewriteRule ^search\.php$ http://test.dev/part/%1? [R=301,L] 
  RewriteRule ^part/(.+)$ /search.php?part=$1 [L]
  </code></pre>
  
  <p>This allows me to go to <strong>test.dev/search.php?part=foo</strong> and it rewrites/redirects the url to <strong>test.dev/part/foo</strong> - this works fine and shows me the correct content.</p>
  
  <p>However, I can also go to <strong>test.dev/search.php?part=foo,bar</strong> and it rewrites/redirects the url to <strong>test.dev/part/foo,bar</strong> - even though this shows up the correct content, this is not what I want the url to look like.  </p>
  
  <p>Is there a way to take into account what's in the url after 'part' and if it finds a comma, remove the comma and anything after it?</p>
  
  <p>I'd still need the 'foo' and 'bar' to be read by my code and show the correct content for those two options but for the url to show <strong>test.dev/part/foo</strong> (as foo was the first one in the url).</p>