debian – removing index.php from URL

I am running a wordpress site with Astra theme.

I use the custom permalinks and I would like to remove index.php from url.

I have the following .htaccess file:

# BEGIN WordPress                                                                                                                                                                                          
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are                                                                                                                                 
# dynamically generated, and should only be modified via WordPress filters.                                                                                                                                
# Any changes to the directives between these markers will be overwritten.                                                                                                                                 
<IfModule mod_rewrite.c>                                                                                                                                                                                   
RewriteEngine On                                                                                                                                                                                           
RewriteBase /                                                                                                                                                                                              
RewriteRule ^index.php$ - (L)                                                                                                                                                                             
RewriteCond %{REQUEST_FILENAME} !-f                                                                                                                                                                        
RewriteCond %{REQUEST_FILENAME} !-d                                                                                                                                                                        
RewriteRule . /index.php (L)                                                                                                                                                                               
# END WordPress                                                                                                                                                                                            

At this point, if I still have index.php in my URL, I think that the .htaccess file is ignored by apache. This is my /etc/apache2/apache2.conf setting:

<Directory /var/www/wordpress/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Allow from All

  Require all granted

All is granted and I can do whatever garbage in my .htaccess file, it does nothing.

I put garbage also in the but still nothing changed.

My Module rewrite is already enabled.

Thank you for your help.