title: How to write multi rewrite rule according to url parameters
body: <p>I have two url formats: </p>
  
  <pre><code>/images/www/en/news/editor/2017/1483346245-index.jpeg
  </code></pre>
  
  <p>And:  </p>
  
  <pre><code>/images/www/news/editor/2017/1483346245-index.jpeg
  </code></pre>
  
  <p>The difference is in the language prefix; note the <code>en/</code> segment in the first URL.</p>
  
  <p>My rewrite rules are: </p>
  
  <pre><code>RewriteRule ([^/]+)/([^/]+)/(fa|en|ar|fr|de)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /file/image?website=$1&amp;language=$2&amp;preset=$4&amp;name=$6 [L,R=302,QSA]
  RewriteRule ([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ /file/image?website=$1&amp;preset=$3&amp;name=$5 [L,R=302,QSA]
  </code></pre>
  
  <p>But only the second rule is working. Any suggestions?</p>