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


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

这里,我想删除index.php?file=我网站的每个url。我尝试了很多.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=$1 [L,QSA]
</IfModule>