2

I have this URL: http://localhost/fixbud/ as my home URL. My page is rendering fine. But when I go to another link like: http://localhost/fixbud/answer_forum I get error 404.

Here are my routes:

$route['default_controller'] = "fixbudd";
$route['404_override'] = '';
$route['index'] = "fixbudd/index";
$route['answer_forum'] = "fixbudd/answer_forum";

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

config

$config['base_url'] = 'http://localhost/fixbud/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

Can you tell me the rules in routing URL and how to solve my problem? I am using CI2

easydev
  • 21
  • 4

3 Answers3

1

This happens because of the .htaccess file, I prefer making new .htaccess file for local env and add the following code.

RewriteEngine on

RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)

RewriteCond %(REQUEST_FILENAME) !-f

RewriteCond %(REQUEST_FILENAME) !-d

RewriteRule ^(.*)$ ./index.php/$1 [L]
Simas Joneliunas
  • 2,522
  • 12
  • 20
  • 28
0

I had the same problem and added this to apache config solved it.

   <Directory "<to your project">

       Options Indexes FollowSymLinks MultiViews

       AllowOverride All

      Order allow,deny

      allow from all

      Require all granted

</Directory>

source http://acmeextension.com/remove-index-php-in-your-codeigniter-project/

Smiled_One
  • 345
  • 2
  • 14
-1

Change $config['base_url'] = 'localhost/fixbud/';

This to

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

And your call is going to "fixbudd" controller and method "answer_forum";

Hikmat Sijapati
  • 6,557
  • 1
  • 7
  • 18
kailas
  • 109
  • 4
  • still not working. when i enter http://localhost/fixbud/answer_forum in the url, still error 404 object not found. but http://localhost/fixbud still works. – easydev Jan 18 '17 at 14:22