CodeIgniter Forums
Route doesn't work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Route doesn't work (/showthread.php?tid=56741)



Route doesn't work - El Forum - 01-16-2013

[eluser]kezman[/eluser]
Hey!
My routes.php doesn't work.
Here the code
Code:
$route["test"] = "blogs";

$route['default_controller'] = "mainpage";
$route['404_override'] = '';

My .htaccess saved in ANSI

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|css|images|robots\.txt|css)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

In my config.php

Code:
$config['uri_protocol'] = 'AUTO';

I type

Code:
http://localhost/test/

and got "page not found" and the same URL.
What's wrong?
I want URL to be changed to
Code:
http://localhost/blogs/
first

Thanks!


Route doesn't work - El Forum - 01-16-2013

[eluser]InsiteFX[/eluser]
And what is the name of your controller?



Route doesn't work - El Forum - 01-16-2013

[eluser]CroNiX[/eluser]
Routes won't change what appears in the URL anyway; you'd have to do that with htaccess. All a route does is take the request, if it matches the route conditions) and sends it to a different controller than would normally be used.

So if your route was:
Code:
$route["test"] = "blogs";

The url is still "http://yoursite.com/test", but it will load the "blogs" controller (which must exist) instead of the "test" controller (which doesn't have to exist - it's just the named route).