问题
I can't seem to get my routing to work correctly. Right now to reach my main page I need to go to www.website.com/core
I would like this to be only website.com
to get to the core.
The second issue I am having is I con not being able to retrieve any css and other files stored in the assets folder. Could you please take a look at my configs and tell me which parts I should adjust? I don't even mind moving the assets folder to a different place on the server, I just really want to get this to work.
the hierarchy on to access CI is as follows
(root)/www/application/OBS/controllers...
My css, js and other assets are stored in
(root)/www/assets/OBS/css/style.css... //example rout to css
In CI I am trying to use
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/OBS/css/core_css.css" />
to link the styles and assets and
<a href="<?php echo base_url('detail/'$id) ?>">
to link to functions from views
My htaccess looks like this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
In the CI's config I have set the following:
$config['base_url'] = 'website.com/core'; //core is used as home/main
$config['index_page'] = '';
And finally in the CI's index.php I have set:
$application_folder = 'application/OBS';
Thank you all for reading and in advance for your replies.
回答1:
Try this ,
set your base_url
to website.com
only
//application/config/config.php
$config['base_url'] = 'website.com';
Then on routes
set the default controller to core
//application/config/routes.php
$route['default_controller'] = "core";
来源:https://stackoverflow.com/questions/21255164/could-you-help-me-set-up-my-ci-uri-routing