title: How can I use htaccess to remove a URL parameter but keep a dynamic element?
body: <p>Google has discovered a pager in the sidebar of a website that allows the user to scroll through 'tags' while on a blog entry, each pager click taking you to a new url, e.g. <code>example.com/blog/article-title?page=1</code>.</p>
  
  <p>Since the blog has ~ 500 posts and the pager has ~ 140 pages of tags, Google has indexed a very high number of pages for my site. I don't want this for a number of reasons. I've already removed the pager on this tag block as it's completely unnecessary, but now would like to do 301 redirects on all of these <code>?page=X</code> URLs in the hopes that, over time, Google will remove them from their index.</p>
  
  <p>The URLs look like this:</p>
  
  <ul>
  <li><a href="http://example.com/blog/blog-article-title?page=0" rel="nofollow">http://example.com/blog/blog-article-title?page=0</a></li>
  <li><a href="http://example.com/blog/blog-article-title?page=1" rel="nofollow">http://example.com/blog/blog-article-title?page=1</a></li>
  <li><a href="http://example.com/blog/blog-article-title?page=2" rel="nofollow">http://example.com/blog/blog-article-title?page=2</a></li>
  </ul>
  
  <p><strong>How can I do a 301 redirect via htaccess that will send the user to  <code>http://example.com/blog/blog-article-title</code>  ?</strong></p>
  
  <p>I've tried many variations on</p>
  
  <ul>
  <li><code>RewriteRule ^blog/(.*).?page(.*)$ /$1/blog/$2?
  [R=301,L]</code></li>
  </ul>
  
  <p>and</p>
  
  <ul>
  <li><code>RedirectMatch 301 ^/blog/(.*)\?page(.*)$ /blog/$1</code></li>
  </ul>
  
  <p>but no luck thus far. Any help would be much appreciated.</p>
  
  <p><strong>Edit:</strong> For others that may stumble upon this, Google had completely ignored the canonical URL that is defined in the header and indexed all 30,000+ URL combinations. Doing the htaccess rewrite in the accepted answer below is properly performing a 301 on these pages. This, of course, requires that I move the pager elsewhere, but that's already been handled in my particular situation.</p>