CodeIgniter Forums

Full Version: Routing for beginners
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]José Mota[/eluser]
Hello, friends.

I'm having a lot of trouble on routing. I have this simple rule:
Code:
$route['signup'] = "users/signup";
I have a controller named Users with a function called signup.

It's not working... I get a direct 404 from Apache. What should I do?

Thanks for the help!

El Forum

[eluser]ontguy[/eluser]
Does the 404 only happen when you use the segment "signup"? Does "users/signup" work?

El Forum

[eluser]José Mota[/eluser]
"users/signup" doesn't work either. :S

One thing. Do I have to put index.php/ EVERYTIME I want to create a URL?

EDIT: Problem solved! I had forgotten to put "index.php/" before the URL. Sorry.

El Forum

[eluser]Colin Williams[/eluser]
You can use mod_rewrite (on Apache) to remove the index.php part. See http://codeigniter.com/wiki/mod_rewrite/

El Forum

[eluser]xwero[/eluser]
José you can use the site_url function from the url helper to prevent forgetting to add the index.php to your urls.