title: htaccess redirect all images to different location and put image name in new url
body: <p>This is the rewrite rule that I am working with:</p>
  
  <pre><code>RewriteRule (.*\.(jpe?g|gif|bmp|png))$ http://www.newurl.com/?image=$1
  </code></pre>
  
  <p>What I want is all images to get redirected to the new location and this above rule works paritally.  The problem is that $1 will contain the whole url from the old request and not just the filename.  I only need the filename and everything that I try doesnt seem to work properly.  Any help is appreciated.</p>
  
  <p>I think i've figured it out. If anyone has any other solutions though, please don't hesitate to add them.  Thanks.</p>
  
  <pre><code>RewriteRule ^([^.]+)/([^.]+\.(jpe?g|gif|bmp|png))$ http://www.newurl.com/$2
  </code></pre>
  
  <p>Thanks.</p>