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
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/
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With