title: .htaccess change /es/ to .es
body: <p>I am working with a domain like: </p>
  
  <pre><code>http://www.domain.com/es/blabla.html
  </code></pre>
  
  <p>And I want to change the /es part for .es and convert the URLS to something like:</p>
  
  <pre><code>http://www.domain.com.es/blabla.html
  </code></pre>
  
  <p>I've been trying lots of possibilities but I haven't reached a solution.</p>
  
  <p>For example one of them has been:</p>
  
  <pre><code>RewriteRule ^es/(.*)$ http://www.domain.com.es/$1 [L]
  </code></pre>
  
  <p>But it has entered in an infinite loop. Which I've tried to avoid adding this lines:</p>
  
  <pre><code>RewriteCond %{ENV:REDIRECT_STATUS} 200
  RewriteRule .* - [L]
  </code></pre>
  
  <p>But the server doesn't allow this calls. So I still have the problem.</p>