Solution 1. Using CodeIgniter routing
try this in your application/config/routes.php
$route ['api/(:any)'] = "api/$1";
$route ['(:any)'] = "home/index/$1";
$route ['default_controller'] = "home";
For any matching
()
in patter, you'l need to add respective$1
or$2
,$3
.. based on position of that()
patter. i.e for first()
its $1, for second()
its$2
and so on.You'l need to set your default controller to
home
.
Solution 2. Using .htaccess page redirection
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/api(.*)$
RewriteCond %{REQUEST_URI} !^/home/index$
RewriteRule ^.*$ /home/index [R=301,QSA,L]