Cannot remove index.php from SocialEngine site's url

I have a SocialEngine site on my local development computer. I am trying to remove index.php from urls with the same .htaccess file that I have on the online server, but index.php still appears for most urls. The only place index.php does not appear is accessing files in the public directory e.g. http://localhost/public/car.png, but to open e.g. an API url like http://localhost/index.php/restapi/music/browse, index.php has to be included.

My .htaccess content:

RewriteCond %{HTTP_HOST} ^example\.ir$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.ir$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]
RewriteCond %{HTTP_HOST} ^examplegood\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.examplegood\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
#RewriteRule ^/?$ "https\:\/\/example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^examplewood\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.examplewood\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]
RewriteCond %{HTTP_HOST} ^examplepic\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.examplepic\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]

# $Id: .htaccess 9977 2013-03-19 20:51:56Z john $
php_value post_max_size 2048M 
php_value upload_max_filesize 2048M 
<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On

#for redirect urls

   RewriteCond %{HTTP_HOST} ^test.example.com [NC,OR]
   RewriteCond %{HTTP_HOST} ^test.example.com [NC]
   RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]


#RewriteCond %{HTTPS} !on
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /index\.php
  RewriteRule (.*) index.php?rewrite=2 [L,QSA]

  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]

  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public\/ [OR]
  RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]

  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]

</IfModule>

# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On

# @todo This may not be effective in some cases
FileETag Size

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>