简体   繁体   中英

CodeIgniter cannot find anything other than default_controller

I am very new to CodeIgniter so obviously I have problem with the most basic things. I have recently tried to implement a website on local environment. I am using WAMP and the website is in www/public_html. Now the website is working on my localhost but if I try to navigate to any other page from the default (default_controler) it returns not found like

The requested URL /public_html/signin/login/ was not found on this server

I assumed that the website was designed to resolve its path related problems by itself. I am obviously missing something very basic.

I have changed the base_url in the config.php file by the way.

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

I have no clue where else the base_url are or where to change it. Any help will greatly appreciated.

Zain

You are getting this problem because you don't have your .htaccess file configured correctly. At the document root in your .htaccess file you need the following

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

In your config.php you will need to do

$config['index_page'] = '';

You also need to make sure you have mod_rewrite enabled

ther is a problem with your index.php. check this line

$config['index_page'] = 'index.php';

if it works u have to add an ht access file to remove index.php from ur url

there are a lot of code for .htaccess file on web try using one that suits you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM