有人可以帮助我吗?我的机器上安装了Apache / 2.4.39 + PHP 7.3.6和Windows 10 x64。我已经检查了是否也启用了重写功能。实际上,我的.htaccess中有此代码,并且可以正常工作。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我已经尝试过其他配置,例如:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
但没有成功。
有人有什么想法吗?
如果您希望所有请求都指向索引,则htaccess有点不正确。
尝试一下
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>