这是我的.htaccess
文件代码
RewriteEngine On
RewriteBase /api
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
文件路径
api/
- htaccess
- index.php
这个网址工作正常
http://localhost/api/index.php/inventory/login/
但是 http://localhost/api/inventory/login/
显示 404 未找到错误。如何解决这个问题?
最佳答案
添加
这在 apache 站点启用文件里面 <virtualHost>
标签
<Directory "/var/www/html">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
和.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
关于php - htaccess URL 重写在 PHP Slim 框架中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34526190/