【问题标题】:htaccess URL Rewriting not working in PHP Slim frameworkhtaccess URL重写在PHP Slim框架中不起作用
【发布时间】:2016-04-04 05:32:57
【问题描述】:

这是我的.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 not found 错误。如何解决这个问题?

【问题讨论】:

标签: php apache .htaccess mod-rewrite slim


【解决方案1】:

添加 <virtualHost> 标签内的 apache 站点启用文件

<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]

【讨论】:

    猜你喜欢
    • 2014-06-06
    • 2015-09-16
    • 2015-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多