当文件夹是另一个 php 应用程序的子文件夹时隐藏 codeigniter 文件夹名称

Hide codeigniter folder name when folder is subfolder of another php application

我在这个应用程序的子文件夹中有核心 php 应用程序和 codeigniter。我想隐藏单个控制器的 CI 文件夹名称。就像

原url是 http://example.com/ci/welcome/test

例外的URl是

http://example.com/welcome/test

这个的 htaccess 基本解决方案是什么

请使用这个:

RewriteEngine On
RewriteRule ^ci/(.*)$ / [L,R=301,QSA]   

我找到了解决方案

  1. 在 htaccess 中

RewriteRule ^([a-zA-Z0-9-_']+)/([a-zA-Z0-9-_']+) ci// [L,NC,QSA]

  1. 在 index.php 最后一行将 require_once BASEPATH.'core/CodeIgniter.php'; 更改为 require_once APPPATH.'core/CodeIgniter.php';

3 在 APPPATH 上。'core/CodeIgniter.php' 搜索 $RTR 并将此代码放在

后面
if( $RTR->class =='mainfoldername' ){
            $RTR->class =$RTR->method;
            $RTR->method = $RTR->uri->rsegments[3];
            $total_segment = count( $RTR->uri->segments );
            foreach( $RTR->uri->segments as $k=>$uri  ){
                if( $k != $total_segment ){
                    $RTR->uri->segments[$k] = $RTR->uri->segments[$k+1];
                    $RTR->uri->rsegments[$k] = $RTR->uri->rsegments[$k+1];
                }
            }

        }

试试这些

重写规则 ^(.*)$ci/$1[L]