首页 > 解决方案 > HMVC Api 请求给出 404

问题描述

我有一个 ci3 和 react js 项目,我的应用程序位于 var/www/html/reactframework 目录中,我已经像这样配置了我的虚拟主机和 .htaccess

> <VirtualHost *:8081>
>         ServerAdmin webmaster@localhost
>         ServerName local.reactframework.com
>         DocumentRoot /var/www/html/reactframework
>         ErrorLog ${APACHE_LOG_DIR}/error.reactframework.log
>         CustomLog ${APACHE_LOG_DIR}/access.reactframework.log combined </VirtualHost>

.htaccess 在根

RewriteEngine On
Options -Indexes
Header always edit Set-Cookie (.*) "$1; HTTPOnly"
Header set X-XSS-Protection "1; mode=block"

<IfModule mod_rewrite.c>
    RewriteRule (.*) http://www.example.com/$1?vardump&thex=%{REQUEST_FILENAME} [R=301,L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ index.html [NC,L]
</IfModule>

用户应用程序中的 .htaccess

RewriteEngine On

Options -Indexes
Header always edit Set-Cookie (.*) "$1; HTTPOnly"
Header set X-XSS-Protection "1; mode=block"

#php_value session.cookie_httponly 1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

我一直在尝试让它工作一段时间,但我无法访问我的 api。我的项目结构是这样的

reactframework
...user
....application
......modules
.......auth
.........controllers
...........Auth.js
....htacces

同样的项目已经上线并且在 aws 上正常工作,我是新手,一直在尝试为我的系统配置它。我敢肯定这是我找不到的非常小的东西。请帮忙 !!!

标签: .htaccesscodeigniterapache2codeigniter-3hmvc

解决方案


推荐阅读