I successfully applied these steps:
1- open catalog/controller/startup/startup.php
after the line:
$languages = $this->model_localisation_language->getLanguages();
add the following code:
if(isset($this->request->get['lng'])){
$this->session->data['language'] = $this->request->get['lng'];
}
2- added the following lines to .htaccess file:
RewriteRule ^en/([^?]*) index.php?_route_=$1&lng=en [L,QSA]
RewriteRule ^ar/([^?]*) index.php?_route_=$1&lng=ar [L,QSA]
3- added languages flags to the template file:
<div class="languageFlags">
{% for language in languages %}
<a href="/{{ language['code'] }}">
<img src="catalog/language/{{ language['code'] }}/{{ language['code'] }}.png" alt="{{ language['name'] }}" title="{{ language['name'] }}" />
</a>
{% endfor %}
</div>
Now when I navigate to www.mysite.com/en it will go to English language and this is true for other languages, and now search engine can index other languages pages.