php - Codeigniter Routing for static pages home page working other routes not pages -


when access localhost:8080/ignite_me shows me contents of home.php header , footer when try localhost:8080/igniteme/test gives me apche 404 page , test.php exist in views/pages have put home.php

even localhost:8080/igniteme/home not working localhost:8080/igniteme shows content of home.php

routes.php

$route['(:any)'] = 'pages/view/$1'; $route['default_controller'] = 'pages/view'; $route['404_override'] = ''; $route['translate_uri_dashes'] = false; 

pages.php

<?php class pages extends ci_controller {      public function _construct()     {         parent::_construct();     }          public function view($page = 'home')         {             if ( ! file_exists(apppath.'/views/pages/'.$page.'.php'))             {                 // whoops, don't have page that!                 show_404();             }              $data['title'] = ucfirst($page); // capitalize first letter                $this->load->view('templates/header', $data);             $this->load->view('pages/'.$page, $data);             $this->load->view('templates/footer', $data);         } } 

.htaccess

<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l]  </ifmodule> 

config.php

$config['base_url'] = 'http://localhost:8080/igniteme/'; $config['index_page'] = ''; 

i unable understand why home.php works localhost:8080/ignite_me , why not localhost:8080/igniteme/home or other page not working have copied .htaccess other stack overflow question not working default one.

here link complete codeignite folder igniteme

i using wamp use htaccess below

options +followsymlinks options -indexes directoryindex index.php rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l,qsa] 

make sure in main directory.

also in wamp make sure you have enabled apache mod rewrite

scroll/click , go down list find rewrite_module click on go , restart wamp.

enter image description here


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -