Reputation: 1280
I have core php application and codeigniter in subfolder of this application. i want to hide CI folder name for a single controller . just like
The original url is
http://example.com/ci/welcome/test
and the excepted URl is
http://example.com/welcome/test
what is the htaccess base solution for this
Upvotes: 2
Views: 1185
Reputation: 1280
I got solution
RewriteRule ^([a-zA-Z0-9-_']+)/([a-zA-Z0-9-_']+) ci/$1/$2 [L,NC,QSA]
require_once BASEPATH.'core/CodeIgniter.php';
to require_once APPPATH.'core/CodeIgniter.php';
3 on APPPATH.'core/CodeIgniter.php' search $RTR and put this code behind
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];
}
}
}
Upvotes: 0
Reputation: 1528
please use this :
RewriteEngine On
RewriteRule ^ci/(.*)$ /$1 [L,R=301,QSA]
Upvotes: 1