如何删除 index.php?file= 使用 .htaccess 获取最后一个 url

how to remove index.php?file= using .htaccess to get last url

在这里,我想为我网站的每个 url 删除 index.php?file=。我已经尝试了很多 .htaccess 教程,但不幸的是没有创建正确的教程。
实际url如下:

http://localhost/test/json/iscore2/index.php?file=home
http://localhost/test/json/iscore2/index.php?file=contact 

那我想做成这样:

http://localhost/test/json/iscore2/home
http://localhost/test/json/iscore2/contact

可能您已经在 apache2 中设置了重写模块 (sudo a2enmod rewriteAllowOverride 的主机设置)

我会从 iscore2 文件夹中的类似内容开始

<IfModule mod_rewrite.c>

    RewriteEngine on

    # Play with this if redirection fails
    #RewriteBase /

    # if it is not a file or folder, rewrite to index.php?file=<value>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?file= [L,QSA]

</IfModule>