CodeIgniter Forums
base url suddenly stopped working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: base url suddenly stopped working (/thread-40651.html)



base url suddenly stopped working - El Forum - 04-14-2011

[eluser]johnmerlino[/eluser]
Hey all,

I have this configured in config.php:

Code:
$config['base_url']    = "http://hmlaw/";

Worked fine for a while. But as I added stuff to the site, now when I try to access it, I get a 404 Page Not Found error. This is running off my local host and I haven't changed the virtual host settings in apache (in fact I can access pages like http://hmlaw/home just fine). I temporarily removed everything in the routes to see if that was the cause, but even then I was getting 404. Not sure where else to look for problems.

Thanks for response.


base url suddenly stopped working - El Forum - 04-15-2011

[eluser]Josh Holloway[/eluser]
Does your default controller still exist?

If you've delete the default controller you'll need to open the routes.php file and change:
Code:
$route['default_controller'] = "welcome";

to a controller that exists.


base url suddenly stopped working - El Forum - 04-15-2011

[eluser]johnmerlino[/eluser]
Thanks for the response. When user enters url, a method gets called that dynamically generates content from database for that url, so I had to check whether there was indeed a uri segment and if not redirect to a page:

Code:
elseif(!$this->uri->segment(1)){
                redirect('homes');
            }