Hendeca
Hendeca

Reputation: 943

How do I edit the index page of your domain in CodeIgniter?

So right now I have this in my .htaccess page:

RewriteEngine On
RewriteCond $1 !^(index\.php|images|js|fonts|css|robots\.txt)
RewriteRule ^(.+)$ index.php?$1 [L]

which makes it so that I can access http://www.yourdomain.com/index.php/page by going to http://www.yourdomain.com/page. However what I can't figure out is how to edit the page that shows up at http://www.yourdomain.com.

I've tried creating a controller called index, but this doesn't do anything unless you go to http://www.yourdomain.com/index

Can anyone help with this? Thank you!!!

Upvotes: 0

Views: 154

Answers (1)

No Results Found
No Results Found

Reputation: 102814

The default controller that loads when there are no url segments is defined in
application/config/routes.php:

From: http://codeigniter.com/user_guide/general/routing.html

Reserved Routes

$route['default_controller'] = 'welcome';

This route indicates which controller class should be loaded if the URI contains no data, which will be the case when people load your root URL. In the above example, the "welcome" class would be loaded. You are encouraged to always have a default route otherwise a 404 page will appear by default.

If there are no url segments besides the controller itself, by default the index() method of that controller is called (this is always the case, not just in regards to routing). So with this example you would look at the welcome controller and index method and see which view files etc. are being loaded.

Upvotes: 1

Related Questions