htaccess URL 重写在 PHP Slim 框架中不起作用
htaccess URL Rewriting not working in PHP Slim framework
这是我的.htaccess
文件代码
RewriteEngine On
RewriteBase /api
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
文件路径
api/
- htaccess
- index.php
这个 url 工作正常
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]
这是我的.htaccess
文件代码
RewriteEngine On
RewriteBase /api
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
文件路径
api/
- htaccess
- index.php
这个 url 工作正常
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]