如何用htacces修复url

uku*_*ung 2 php .htaccess

我有一个网址,最初是http://web.com/index.php/home/funct/,我想通过删除index.php来改变它,以便它变成http://web.com/home/funct/

Xeo*_*oss 6

如果您使用的是Apache服务器,请创建一个名为的文件.htaccess并将其放入其中:

<IfModule mod_rewrite.c>
    RewriteEngine on

    # If the file/dir is NOT real go to index
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

然后从链接中删除对"/index.php/"的引用,当服务器找不到"home/funct"时,它将查找"/index.php/home/funct".