title: Remove block after last dash in url using htaccess
body: <p>Old web has url in this form: </p>
  
  <pre><code>www.oldwebsite.com/something-d801.htm 
  or www.oldwebsite.com/something-something-806.htm
  </code></pre>
  
  <p>I want to remove part after last dash because without last part I have same exact url as new website (<code>www.newwebsite.com/something</code>). I would much rather do it in php router, but I think htaccess version is much more appropriate overall.</p>
  
  <p>I guess there should be something similar to regexp, but only thing I found is line to strip everything after last slash : </p>
  
  <blockquote>
    <p>You can use <code>sed -e 's/\(.*\)\/[^\/]*/\1/g'</code></p>
  </blockquote>
  
  <p>But since I dont know much about htaccess I dont know which slash I should replce by dash in this line.</p>
  
  <p>Also, here's my current htaccess:</p>
  
  <pre><code>SetEnv APPLICATION_ENV development
  
  RewriteEngine on
  
  RewriteCond %{HTTP_HOST} !^www
  RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R]
  
  RewriteRule ^$ public/ [L,QSA]
  RewriteRule ^(.+)$ public/$1 [L,QSA]
  
  # EXPIRES CACHING ##
  &lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType text/x-javascript "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresDefault "access plus 7 days"
  &lt;/IfModule&gt;
  FileETag MTime Size
  # EXPIRES CACHING ##
  </code></pre>