【问题标题】:Slim Framework API - how to configure .htaccess file for multiple .php's storing APISlim Framework API - 如何为多个 .php 的存储 API 配置 .htaccess 文件
【发布时间】:2018-03-24 02:35:38
【问题描述】:

我正在使用 slim 框架和 angular 为库系统构建一个 crud api。但在我的 api 文件夹中,我想要多个 .php 文件。例如,authors.php、publishers.php 等我有作者 crud 系统工作并且我为publishers.php重写了它..但它找不到我的数据库记录并且没有给出任何错误..我有强烈的感觉它是我的.htaccess文件..但我不确定如何为多个.php配置它文件

这是我目前的 .htaccess .. 任何帮助都将不胜感激,因为我是所有这些技术的新手

# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ authors.php [QSA,L]

【问题讨论】:

  • 但是为什么,当你有 Slim 时? Router

标签: php mysql angular api slim


【解决方案1】:

Angular application deployment configuration:

Apache:向 .htaccess 文件添加重写规则,如图所示 (https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/):

RewriteEngine On
    # If an existing asset or directory is requested go to it as it is
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteRule ^ - [L]
    # If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html

【讨论】:

    猜你喜欢
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-24
    • 1970-01-01
    相关资源
    最近更新 更多