Reputation: 742
Since I changed a website to another server, I have a problem that I can't access the website on domain.com/codeigniter/ . My default controller is info/ It worked with http://www.domain.com/codeigniter/info/ and http://www.domain.com/codeigniter/info/model/
$route['default_controller'] = "info/";
$route['404_override'] = '';
$route['info/(:any)'] = "info/view/$1";
.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
But on the new server it doesn't work. The problem is that it always ends in http://www.domain.com/index.php and not the index.php of the directory of the codeigniter installation..
What could be the problem?
Upvotes: 1
Views: 462
Reputation: 742
After changing the .htacces and leaving the 'base_url' empty (http://www.domain.com/codeigniter/ doesn't work).
I have the following problems:
http://www.domain.com/codeigniter/ --> ERROR 404 from CI
http://www.domain.com/codeigniter/info/ --> No input file specified
http://www.domain.com/codeigniter/index.php/info/ --> OK
EDIT: Problem solved.. I forgot a ? after the index.php in the .htaccess & I changed the default controller in routes.php to info/view/home/
It was a combination of multiple things... It is strange that it worked on the old hosting. It was obviously wrong..
Upvotes: 1
Reputation: 1461
there are a few things that make CodeIgniter work in secondary folder: first of all, you must change $config['base_url'] = http://www.domain.com/codeigniter/';
in application/config/config.php.
Then, of course, change .htacces file to this:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# block hidden directories
RewriteRule "(^|/)\." - [F]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>
Php mod_rewrite module is needed.
Upvotes: 1