CodeIgniter Forums
Problem with Routes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem with Routes (/showthread.php?tid=72452)



Problem with Routes - Antuan007 - 12-21-2018

Hello friends i have a problem with routes "i think".

after remove the "index.php" from URL my router config is: 

PHP Code:
$route['default_controller'] = "links";
$route['translate_uri_dashes'] = FALSE;
$route['404_override'] = '';
$route['(:any)'] = 'links/index/$1'

Base url: 

Code:
$config['base_url'] = 'http://127.0.0.1/test/';


the links controller have a function like this:

PHP Code:
public function index($head FALSE){
        
        if(
$head === FALSE){

        
links::create();

 
       }elseif($head){

 
           links::search();

 
       }        
 
   


so when i go to "http://127.0.0.1/test/" everything is going ok, for "http://127.0.0.1/test/baaaah"
i get a 404 not found, but when i manually put "http://127.0.0.1/test/index.php/baaaah" its works.

i don't know where is the mistake, i tried split the controllers, i read the uri, url, routing documentation and look in stackoverflow and didn't find a clue.

thanks and have a good day.


RE: Problem with Routes - php_rocs - 12-21-2018

@Antuan007,

Maybe this will be helpful... ( https://www.codeigniter.com/userguide3/general/urls.html#removing-the-index-php-file )


RE: Problem with Routes - demyr - 12-30-2018

After you set your .htaccess for codeigniter you should go to application/config file and find the line for

Code:
$config['index_page'] = 'index.php';
apprx line at 38. Remove the index.php and leave it blank : $config['index_page'] = '';

Good Luck.


RE: Problem with Routes - Antuan007 - 01-19-2019

Thanks demyr and php_rocks for replying me really appreciate, the problem was in the apache2 conf, figured out testing in another environment ( windows with xampp and worked). the CI config, routes and .htacces were good all the time.

Good luck, best regards