cycledude
asked on
codeigniter routing issues?
Hi
Just starting out with codeigniter and have a couple of problems...
I have a simple controller, called public_site.php
in the routes.php I have set the default_controller to public_site
the controller has 2 methods
index
about
1: if I browse to ‘www.myurl.com/ci’ the index page displays fine
2: if I browse to ‘www.myurl.com/ci/index.php/about’ i get a 404 page not found
3: however if i browse to ‘www.myurl.com/ci/index.php/public_site/about’ it displays the page
also I am having problems with the location of the css.. in scenario 1 above the page displays with css correct, however with scenario 3, the page displays with no css… how do you keep track of the css location if you are using a template header and footer?
Thanks
cycledude
Just starting out with codeigniter and have a couple of problems...
I have a simple controller, called public_site.php
in the routes.php I have set the default_controller to public_site
the controller has 2 methods
index
about
1: if I browse to ‘www.myurl.com/ci’ the index page displays fine
2: if I browse to ‘www.myurl.com/ci/index.php/about’ i get a 404 page not found
3: however if i browse to ‘www.myurl.com/ci/index.php/public_site/about’ it displays the page
also I am having problems with the location of the css.. in scenario 1 above the page displays with css correct, however with scenario 3, the page displays with no css… how do you keep track of the css location if you are using a template header and footer?
Thanks
cycledude
ASKER
@frisoft
thanks for the help, adding the about route sorted it...
I am a little confused as I thought that was what the 'default_controller' was for...
so that anything in the url after index.php would be a method in the default_controller?
maybe I got the wrong impression?
thanks for the help, adding the about route sorted it...
I am a little confused as I thought that was what the 'default_controller' was for...
so that anything in the url after index.php would be a method in the default_controller?
maybe I got the wrong impression?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help, it was much appreciated.
if You want the ‘www.myurl.com/ci/index.php/about url to work too, you should define route, for example in \application\config\routes
$route['about'] = 'public_site/about'
For css, js and other assets (and in fact for any url) i recommend use of the full path, see helper site_url() for the base url of your site.