Welcome Guest, Not a member yet? Register   Sign In
Route / cannot access function in my controller
#1

[eluser]leaflashdev[/eluser]
Hello

I set up a simple project
I created a controller called portfolio.php in the /controllers/ folder
inside the routes.php class I wrote this line
$route['default_controller'] = "portfolio";
So now if I go on http://localhost:8888/portfolio/ it access my function called index
but If I do http://localhost:8888/portfolio/index or http://localhost:8888/portfolio/dosomething
it seems that the function is not found
Don't really know why

I tried to replace $route['default_controller'] = "portfolio/dosomething";
and when I go back to http://localhost:8888/portfolio I have my echo test
function dosomething(){
echo 'test';
}

Any ideas ?

Thanks !
#2

[eluser]leaflashdev[/eluser]
Ok just figured out that I have to write that
to access my dosomething function

http://localhost:8888/portfolio/index.ph...osomething

Is there a way I can just do that ?

http://localhost:8888/portfolio/dosomething

Thanks for your help !
#3

[eluser]virtualgadjo[/eluser]
Hi,

yes, quite simply,
just add this in your root htaccess file
Code:
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|files|modules|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
and here you are, no more index.php in your url... Smile

have swing
#4

[eluser]leaflashdev[/eluser]
Hello

Thanks a lot , it's working !




Theme © iAndrew 2016 - Forum software by © MyBB