title: htaccess get part of the url to create new url
body: <p>My old url is like this</p>
  
  <pre><code>http://example.com/dir/999-name/profile.html
  </code></pre>
  
  <p>Now I would like to redirect all those urls to the ones shown below</p>
  
  <pre><code>http://example.com/dir/profile/999-name.html
  </code></pre>
  
  <p>I tried with the below one but is not working</p>
  
  <pre><code>RewriteRule ^dir/(.*)/(.*)$ /dir/profile/$1.html [R=301,NC,L]
  </code></pre>
  
  <p>Can someone help me getting the htaccess redirect?</p>