Search code examples
.htaccesscodeignitercodeigniter-2codeigniter-urlcodeigniter-routing

codeigniter 404 page not found in intranet deployment


Please guide me what is the issue? All of my pages are showing 404 not found in intranet deployment, while main (home) page is viewing fine.

.htaccess

RewriteEngine On
RewriteBase /dna/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dna/index.php/$1 [L]

routes.php

$route['default_controller'] = "home";
$route['404_override'] = 'error/index';
$route['pages/(:any)']="pages/view/$1";
$route['contact-us'] = 'contact_us/index';
$route['news'] = 'news/index';

I'll be grateful for any help or guidance.


Solution

  • Codeigniter automatically gets $config['base_url'] for your site, so you can leave that blank Make sure you have mod_rewrite enabled. then modify your .htaccess with this:

    <IfModule mod_rewrite.c>
    
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_URI} ^site_hostname.*
      RewriteRule ^(.*)$ /index.php?/$1 [L]
    </IfModule> 
    

    hope that solves it.