这是我的 codeigniter .htaccess 文件,我成功地将 index.php 替换为方法名称。但我想从 url 中强制删除 index.php,即如果有人在 url 中添加 index.php,我想使用 .htaccess 删除它。喜欢=>http://localhost/project/index.php/welcome
到=>http://localhost/project/welcome
该项目仍在xampp中进行开发。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
# Enforce NO www
RewriteCond %{HTTP_HOST} ^www [NC]
RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
</IfModule>