0

This is my config.php

$config['base_url'] = 'http://localhost/mycms/';<br>

This is my routs.php

$route['default_controller'] = "Page";
$route['404_override'] = 'Page';
$route['article/(:num)/(:any)'] = 'article/index/$1/$2';

This is my Page.php Now my main problem is I could not able to load 'http://localhost/mycms/'and seen '404 Page Not Found'

But If I browse following link then my site run well. localhost/mycms/index.php/Home-Page

  • use `page` instead of `Page` at `route.php` and make sure you have a file `Page.php` in controller folder and contains this line `class Page extends CI_controller` – Shaiful Islam Jan 03 '17 at 12:39
  • Possible duplicate of [Codeigniter URL rewrite to remove index.php](http://stackoverflow.com/questions/31853184/codeigniter-url-rewrite-to-remove-index-php) – Mayank Vadiya Jan 03 '17 at 14:31
  • Your question and problem has no relation.`404 Page Not Found` error happens for different reason. There are lots of answer on that.Search them – Shaiful Islam Jan 03 '17 at 15:37

2 Answers2

0

In your root directory make a new file named as .htaccess with following code

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

And in application/config/config.php set followings

$config['base_url'] = 'http://localhost/mycms/';

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';
Hikmat Sijapati
  • 6,869
  • 1
  • 9
  • 19
0

The problem is .htaccess Try this

in config.php

$config['base_url'] = 'http://localhost/mycms/';   //Your directory
$config['index_page'] = '';

create global .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
Przemek eS
  • 1,224
  • 1
  • 8
  • 21