CodeIgniter 3 with Capistrano htaccess issue



我正在使用Capistrano来部署我的CI3站点,对重写规则知之甚少。我能够从堆栈溢出中找到htaccess规则,但它们都不适合我的情况,所以我在这里。

设法在没有任何程序的情况下运行我的主页,但没有一条路线适合我。它们都返回 CI3 404 页面未找到错误。

我的网站结构:

|-- .htaccess (under domain root)
|-- app/
    |-- current/ -> symlink to latest release folder
        |-- application/
        |-- public/
        |-- index.php
        |-- .htaccess (under project root)
        |-- ...other CI 3 folders and files
    |-- shared/
    |-- repo/
    |-- shared/
    |-- releases/

.htaccess ( 在域名根目录下 )

RewriteEngine On
RewriteBase /
# remove www 
RewriteCond %{HTTP_HOST} !^siteurl.com$
RewriteRule ^(.*)$ http://siteurl.com/$1 [L,R=301]
# redirect to CI3 root
RewriteCond %{REQUEST_URI} !^/app/current/
RewriteRule ^(.*)$ /app/current/$1 [L]

.htaccess (在项目根目录下)

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

配置.php

$config['base_url'] = 'http://siteurl.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

路线.php

$route['default_controller'] = 'welcome';
$route['api/oauth'] = 'api/oauth';

到目前为止,欢迎页面工作正常,但 CI3 404 错误页面返回路由 api/oauth。

请帮忙!!非常感谢!!

我刚刚弄清楚,这是一个愚蠢的错误,控制器名称都是大写的,CI3无法理解。问题已解决。.htaccess 代码有效。

最新更新