Remove index.php and call default controller method when page loads |
[eluser]fiktionvt[/eluser]
I am kind of new to setting up a new page in codeigniter. say my page domain is www.example.com I have a controller called Site, with two methods index(), and home(). When I navigate to www.example.com I want it to call the Site.php controller. It can either call index() or home() it doesn't really matter but I want the url to either display www.example.com or www.example.com/home I know this is very basic but for some reason I can't find how to set this up. Right now when the page loads it somehow finds the Site controller and is calling the index function, I am not sure how it is doing that. Anyway if someone can tell me how to properly do this that would be great. Thanks for any help! -Fik
[eluser]fiktionvt[/eluser]
Sorry to be clear I want my base url of my site to point to www.example.com/index.php/Site/ so when I goto the url www.example.com it is actually is www.example.com/index.php/Site but displays www.example.com sorry if this is confusing
[eluser]CroNiX[/eluser]
In config/routes.php, change the "default controller" to "site". Then whenever anyone visits your domain with no path (www.example.com), it will load the index method of the class site. (www.example.com/site) but only display the domain. As far as getting rid of index.php, this .htaccess rule (in your sites root dir) usually does the trick: Code: RewriteEngine On |
Welcome Guest, Not a member yet? Register Sign In |