Welcome Guest, Not a member yet? Register   Sign In
Configuration of controller
#1

[eluser]Nukede[/eluser]
hi all, I need some help with controller routing
What I need: (for example)
Quote:mysite.com/
mysite.com/news
mysite.com/articles
But now, it's only works like this
Quote:mysite.com/
mysite.com/my_controller/news
mysite.com/my_controller/articles

this is my .htaccess
Code:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|public)
RewriteCond %{REQUEST_URI} !\.(css¦js¦jpg¦gif)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
#2

[eluser]Aken[/eluser]
In config/routes.php:
Code:
$route['(news|articles)'] = 'my_controller/$1';

http://ellislab.com/codeigniter/user-gui...uting.html
#3

[eluser]Nukede[/eluser]
Research Assistant, thx! It's works, but if I will need more links, I will have to do it through routing?
#4

[eluser]Aken[/eluser]
Yes. Or you could create individual controllers for each section, which may prove to be more beneficial.




Theme © iAndrew 2016 - Forum software by © MyBB