Reputation: 329
I know this has been asked many times, and trust me that I've opened them all and following the steps but it still stuck for me. The css is also mess up (http://anakpanti.com/ab-cargo/)
I have CI project and it works in my localhost, but after I move it to webhosting the controller can't be found (except the default one).
The requested URL /ab-cargo/controllers_aboutus/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Here what have I done:
Change.htaccess code into this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
Change file config into:
$config['base_url'] = 'http://anakpanti.com/ab-cargo/';
$config['index_page'] = '';
That's all the steps.
Upvotes: 0
Views: 1777
Reputation: 1521
this is your baseurl right (http://anakpanti.com/ab-cargo/). S add rewiteBase /ab-cargo. Use this .htaccess
RewriteEngine On
RewriteBase /ab-cargo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
When including style sheet in header use base_url() in href tag
<link rel="stylesheet" href="<?php echo base_url();?>CSS/main.css" type="text/css">
Upvotes: 0
Reputation: 329
Oh, I know the problem.
There should be 2 .htaccess files placed in the project.
First, in the root folder:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
And also inside the application folder:
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
Upvotes: 1