8 – How to properly configure Apache to remove /index.php/ from the URL

Configuring Drupal 8.6 with PHP 7.1 on the centos server 7. In httpd.conf I have below the code. "water" is the root folder and docroot is the subfolder that has the Drupal code

DocumentRoot "/ var / www / html / water"

    AllowOverride All
Require all granted

    AllowOverride All
Require all granted

And also I have .htacess case file

RewriteBase /
RewriteCond% {REQUEST_URI} ^ (. *)? / (Install.php) [OR]
RewriteCond% {REQUEST_URI} ^ (. *)? / (Rebuild.php)
RewriteCond% {REQUEST_URI}! Core
RewriteRule ^% 1 / core /% 2 [L,QSA,R=301]
RewriteCond% {REQUEST_URI}! = / Favicon.ico
RewriteRule ^ index.php [L]

But I'm still receiving URL with /index.php/ in it, for example https://www.example.com/index.php/products/chemical. How can I get rid of it?

Thanks to all who solved the problem by adding the following line in .htaccess
RewriteBase / docroot
RewriteRule ^ (. *) $ /Index.php?/$1 [L]